aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorZahira Ammarguellat <Zahira.Ammarguellat@intel.com>2023-06-15 15:44:25 -0400
committerZahira Ammarguellat <Zahira.Ammarguellat@intel.com>2023-06-22 13:24:00 -0400
commit9fc3b4acbc920dc93f4b6eefb4e2b3f795fa9aac (patch)
tree1d483258f766c85e166d22198235853f1233c506 /clang/lib/Basic/IdentifierTable.cpp
parent9ab964e840e44940a57b47a921b0fe97319d1791 (diff)
downloadllvm-9fc3b4acbc920dc93f4b6eefb4e2b3f795fa9aac.zip
llvm-9fc3b4acbc920dc93f4b6eefb4e2b3f795fa9aac.tar.gz
llvm-9fc3b4acbc920dc93f4b6eefb4e2b3f795fa9aac.tar.bz2
[clang] Add a namespace for interesting identifiers.
Differential Revision: https://reviews.llvm.org/D146148
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index 2d1818d..661e9f7 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -279,6 +279,16 @@ static void AddObjCKeyword(StringRef Name,
Table.get(Name).setObjCKeywordID(ObjCID);
}
+static void AddInterestingIdentifier(StringRef Name,
+ tok::InterestingIdentifierKind BTID,
+ IdentifierTable &Table) {
+ // Don't add 'not_interesting' identifier.
+ if (BTID != tok::not_interesting) {
+ IdentifierInfo &Info = Table.get(Name, tok::identifier);
+ Info.setInterestingIdentifierID(BTID);
+ }
+}
+
/// AddKeywords - Add all keywords to the symbol table.
///
void IdentifierTable::AddKeywords(const LangOptions &LangOpts) {
@@ -295,6 +305,9 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) {
#define OBJC_AT_KEYWORD(NAME) \
if (LangOpts.ObjC) \
AddObjCKeyword(StringRef(#NAME), tok::objc_##NAME, *this);
+#define INTERESTING_IDENTIFIER(NAME) \
+ AddInterestingIdentifier(StringRef(#NAME), tok::NAME, *this);
+
#define TESTING_KEYWORD(NAME, FLAGS)
#include "clang/Basic/TokenKinds.def"