aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/IdentifierTable.cpp
diff options
context:
space:
mode:
authorVlad Serebrennikov <serebrennikov.vladislav@gmail.com>2024-02-14 16:39:00 +0400
committerGitHub <noreply@github.com>2024-02-14 16:39:00 +0400
commit502756905c7de5f6217a071b73adda72c46ffd1c (patch)
treecadfcc25cff3497c8556e8bcb136cbe617aaa467 /clang/lib/Basic/IdentifierTable.cpp
parentdebca7ee43522e1702ade36f4954517e35f82886 (diff)
downloadllvm-502756905c7de5f6217a071b73adda72c46ffd1c.zip
llvm-502756905c7de5f6217a071b73adda72c46ffd1c.tar.gz
llvm-502756905c7de5f6217a071b73adda72c46ffd1c.tar.bz2
[clang][NFC] Use "notable" for "interesting" identifiers in `IdentifierInfo` (#81542)
This patch expands notion of "interesting" in `IdentifierInto` it to also cover ObjC keywords and builtins, which matches notion of "interesting" in serialization layer. What was previously "interesting" in `IdentifierInto` is now called "notable". Beyond clearing confusion between serialization and the rest of the compiler, it also resolved a naming problem: ObjC keywords, notable identifiers, and builtin IDs are all stored in the same bit-field. Now we can use "interesting" to name it and its corresponding type, instead of `ObjCKeywordOrInterestingOrBuiltin` abomination.
Diffstat (limited to 'clang/lib/Basic/IdentifierTable.cpp')
-rw-r--r--clang/lib/Basic/IdentifierTable.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp
index d0d8316..a9b07ac 100644
--- a/clang/lib/Basic/IdentifierTable.cpp
+++ b/clang/lib/Basic/IdentifierTable.cpp
@@ -36,7 +36,7 @@ using namespace clang;
// A check to make sure the ObjCOrBuiltinID has sufficient room to store the
// largest possible target/aux-target combination. If we exceed this, we likely
// need to just change the ObjCOrBuiltinIDBits value in IdentifierTable.h.
-static_assert(2 * LargestBuiltinID < (2 << (ObjCOrBuiltinIDBits - 1)),
+static_assert(2 * LargestBuiltinID < (2 << (InterestingIdentifierBits - 1)),
"Insufficient ObjCOrBuiltinID Bits");
//===----------------------------------------------------------------------===//
@@ -280,13 +280,13 @@ 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) {
+static void AddNotableIdentifier(StringRef Name,
+ tok::NotableIdentifierKind BTID,
+ IdentifierTable &Table) {
+ // Don't add 'not_notable' identifier.
+ if (BTID != tok::not_notable) {
IdentifierInfo &Info = Table.get(Name, tok::identifier);
- Info.setInterestingIdentifierID(BTID);
+ Info.setNotableIdentifierID(BTID);
}
}
@@ -306,8 +306,8 @@ 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 NOTABLE_IDENTIFIER(NAME) \
+ AddNotableIdentifier(StringRef(#NAME), tok::NAME, *this);
#define TESTING_KEYWORD(NAME, FLAGS)
#include "clang/Basic/TokenKinds.def"