sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/SourceCode.cpp:638
+  // Keywords are initialized in constructor.
+  clang::IdentifierTable KeywordsTable(LangOpts);
+  return KeywordsTable.find(NewName) != KeywordsTable.end();
----------------
this builds a pretty decent sized hashtable for each call, because LangOpts 
isn't constant.

We could consider exposing getKeywordStatus from IdentifierTable.h, then we 
could build a StringMap<TokenKind> (once, statically) and then call 
getKeywordStatus to apply the per-langopts logic.
In fact that StringMap might also be generally nice to expose in 
TokenKinds.h... as long as there are no conflicts.

Or we could have cache map from LangOpts to IdentifierTable, since we won't see 
many sets in practice.

Or maybe it doesn't matter, I suppose!


================
Comment at: clang-tools-extra/clangd/unittests/SourceCodeTests.cpp:794
+  LangOptions LangOpts;
+  LangOpts.CPlusPlus11 = true;
+  EXPECT_TRUE(isKeyword("int", LangOpts));
----------------
demonstrate some sensitivity to langopts?

e.g. set CPlusPlus20 to true then check co_await


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88810/new/

https://reviews.llvm.org/D88810

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to