[PATCH] D136925: [clangd] Index scoped enums for code completion

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 30 00:53:08 PDT 2022


nridge 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();
 
----------------
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?


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