[PATCH] D137104: [clangd] Add scoped enum constants to all-scopes-completion

Tom Praschan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 04:04:12 PDT 2022


tom-anders marked an inline comment as done.
tom-anders added inline comments.


================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:2136
+  if (llvm::isa<clang::EnumDecl>(ND.getDeclContext()))
+    return true;
 
----------------
nridge wrote:
> Why remove the `(InTopLevelScope(*EnumDecl) || InClassScope(*EnumDecl))` part?
Huh, because I thought this covered all the scopes where you could declare enums anyway, but of course that's wrong - You can e.g. declare a function-local enum, which we of course don't want to index. 


================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:2136
+  if (llvm::isa<clang::EnumDecl>(ND.getDeclContext()))
+    return true;
 
----------------
tom-anders wrote:
> nridge wrote:
> > Why remove the `(InTopLevelScope(*EnumDecl) || InClassScope(*EnumDecl))` part?
> Huh, because I thought this covered all the scopes where you could declare enums anyway, but of course that's wrong - You can e.g. declare a function-local enum, which we of course don't want to index. 
d


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137104



More information about the cfe-commits mailing list