aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/Diagnostic.h18
-rw-r--r--include/clang/Basic/IdentifierTable.h2
2 files changed, 18 insertions, 2 deletions
diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h
index 1bb294e7a4..9dfcf3fe75 100644
--- a/include/clang/Basic/Diagnostic.h
+++ b/include/clang/Basic/Diagnostic.h
@@ -15,6 +15,7 @@
#define LLVM_CLANG_DIAGNOSTIC_H
#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/IdentifierTable.h"
#include <string>
#include <cassert>
@@ -26,7 +27,6 @@ namespace clang {
class DiagnosticClient;
class SourceRange;
class DiagnosticBuilder;
- class IdentifierInfo;
// Import the diagnostic enums themselves.
namespace diag {
@@ -142,7 +142,8 @@ public:
ak_identifierinfo, // IdentifierInfo
ak_qualtype, // QualType
ak_declarationname, // DeclarationName
- ak_nameddecl // NamedDecl *
+ ak_nameddecl, // NamedDecl *
+ ak_selector // Selector
};
private:
@@ -484,6 +485,13 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
}
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+ Selector S) {
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(S.getAsOpaquePtr()),
+ Diagnostic::ak_selector);
+ return DB;
+}
+
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const SourceRange &R) {
DB.AddSourceRange(R);
return DB;
@@ -566,6 +574,12 @@ public:
return reinterpret_cast<IdentifierInfo*>(DiagObj->DiagArgumentsVal[Idx]);
}
+ /// getArgSelector - Return the specified Selector argument.
+ Selector getArgSelector(unsigned Idx) const {
+ assert(getArgKind(Idx) == Diagnostic::ak_selector &&
+ "invalid argument accessor!");
+ return Selector(DiagObj->DiagArgumentsVal[Idx]);
+ }
/// getRawArg - Return the specified non-string argument in an opaque form.
intptr_t getRawArg(unsigned Idx) const {
assert(getArgKind(Idx) != Diagnostic::ak_std_string &&
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index 2584136ec4..b6cee028f4 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -334,6 +334,8 @@ private:
/// selectors that take no arguments and selectors that take 1 argument, which
/// accounts for 78% of all selectors in Cocoa.h.
class Selector {
+ friend class DiagnosticInfo;
+
enum IdentifierInfoFlag {
// MultiKeywordSelector = 0.
ZeroArg = 0x1,