[PATCH] D131007: [NFCI] Refactor how KeywordStatus is calculated
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 2 13:15:24 PDT 2022
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/Basic/TokenKinds.def:400-401
+CXX20_KEYWORD(concept , 0)
+CXX20_KEYWORD(requires , 0)
// Not a CXX20_KEYWORD because it is disabled by -fno-char8_t.
KEYWORD(char8_t , CHAR8SUPPORT)
----------------
================
Comment at: clang/lib/Basic/IdentifierTable.cpp:138-141
+ // KEYALL/KEYALLCXX/etc), so we can check with == throughout this function.
+
+ assert ((Flag &-Flag) == Flag && "Multiple bits set?");
+ switch (Flag) {
----------------
================
Comment at: clang/lib/Basic/IdentifierTable.cpp:169
+ case KEYALTIVEC:
+ return LangOpts.AltiVec ? KS_Enabled : KS_Unknown;
+ case KEYBORLAND:
----------------
Should this one be "extension" instead?
================
Comment at: clang/lib/Basic/IdentifierTable.cpp:173
+ case KEYOPENCLC:
+ return LangOpts.OpenCL && !LangOpts.OpenCLCPlusPlus ? KS_Enabled
+ : KS_Unknown;
----------------
Is this an extension as well? I'll stop asking individually and just ask generally, when should extension be used?
================
Comment at: clang/lib/Basic/IdentifierTable.cpp:232
+ while (Flags != 0) {
+ unsigned LSB = Flags & -Flags;
+ Flags = Flags & ~LSB;
----------------
Rather than pretend negating an unsigned value makes sense, can you switch this to use `Flags & ~(Flags - 1)` instead?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131007/new/
https://reviews.llvm.org/D131007
More information about the cfe-commits
mailing list