================
@@ -250,6 +250,32 @@ static KeywordStatus getKeywordStatus(const LangOptions 
&LangOpts,
   return CurStatus;
 }
 
+static bool IsKeywordInCpp(unsigned Flags) {
+  while (Flags != 0) {
+    unsigned CurFlag = Flags & ~(Flags - 1);
+    Flags = Flags & ~CurFlag;
+    switch (static_cast<TokenKey>(CurFlag)) {
+    case KEYCXX:
+    case KEYCXX11:
+    case KEYCXX20:
+    case BOOLSUPPORT:
+    case WCHARSUPPORT:
+    case CHAR8SUPPORT:
+      return true;
+    default:
+      break; // Go to the next flag, try again.
+    }
+  }
+  return false;
----------------
nikic wrote:

I'm a bit confused by this function. Why does this go through all bits in a 
loop instead of directly checking them? I'd have expected this whole function 
to be something like `return Flags & 
(KEYALLCXX|BOOLSUPPORT|WCHARSUPPORT|CHAR8SUPPORT);`

https://github.com/llvm/llvm-project/pull/137234
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to