This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add scoped enum constants to all-scopes-completion
ClosedPublic

Authored by tom-anders on Oct 31 2022, 12:37 PM.

Details

Summary

This was originally part of https://reviews.llvm.org/D136925, but we decided to move it to a separate patch.
In case it turns out to be controversial, it can be reverted more easily.

Diff Detail

Event Timeline

tom-anders created this revision.Oct 31 2022, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 31 2022, 12:37 PM
tom-anders requested review of this revision.Oct 31 2022, 12:37 PM

Added missing hunk in CodeComplete.cpp

tom-anders updated this revision to Diff 472426.Nov 1 2022, 3:11 PM

Rebase onto previous commit

nridge added a comment.Nov 2 2022, 1:37 AM

The test added in the previous patch, CompletionTest.Enums, needs to be updated to reflect this change (Scoped::Clangd3 now appears as a completion).

clang-tools-extra/clangd/CodeComplete.cpp
2136

Why remove the (InTopLevelScope(*EnumDecl) || InClassScope(*EnumDecl)) part?

tom-anders updated this revision to Diff 472568.Nov 2 2022, 4:03 AM

Update CompletionTest.Enums, keep scope condition in isIndexedForCodeCompletion

tom-anders marked an inline comment as done.Nov 2 2022, 4:04 AM
tom-anders added inline comments.
clang-tools-extra/clangd/CodeComplete.cpp
2136

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.

2136

d

tom-anders updated this revision to Diff 472578.Nov 2 2022, 4:56 AM
tom-anders marked an inline comment as done.

Actually fix test...

nridge accepted this revision.Nov 2 2022, 10:31 AM

Looks good, thanks

This revision is now accepted and ready to land.Nov 2 2022, 10:31 AM