[PATCH] D136925: [clangd] Index scoped enums for code completion
Tom Praschan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 30 02:27:48 PDT 2022
tom-anders added inline comments.
================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:2133
if (const auto *EnumDecl = dyn_cast<clang::EnumDecl>(ND.getDeclContext()))
- return InTopLevelScope(*EnumDecl) && !EnumDecl->isScoped();
----------------
nridge wrote:
> Just to make sure I understand:
>
> By also removing the `!isScoped()` condition, in addition to changing the behaviour for the scenario described in https://github.com/clangd/clangd/issues/1082 (enum declared at class scope), you are also changing the behaviour for scenarios like this:
>
> ```
> enum class Foo { Bar }; // at any scope, including global
> ```
>
> Completing `Bar` will now offer `Foo::Bar` when previously it didn't.
>
> Is this your intention?
Ah sorry, that is indeed not what I described in the issue - but yeah this change is intended here, IMO it's more consistent from a user perspective: Why should **all-scopes**-completion ignore **scoped** enums?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136925/new/
https://reviews.llvm.org/D136925
More information about the cfe-commits
mailing list