Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Can you also add a test, preferably in clang/test/CodeCompletion/overrides.cpp ?
clang/lib/Parse/ParseDecl.cpp | ||
---|---|---|
3269–3270 | i think the importance of ordering requires a comment here, maybe something like: |
I've added a test case but I have a question.
This is regardless of the current issue (i.e. no function context, clang++14 with no patches)
struct X { virtual void foo(); }; struct Y : public X { over };
I am trying to complete override in class Y here, but I get no result.
The command I am using is:
clang++ -cc1 -xc++ -code-completion-patterns -fsyntax-only -code-completion-at="test.cpp:5:2" test.cpp
The only output I get is: COMPLETION: operator
If I start the completion at the first column I receive the correct result.
Is my invocation correct or is this case handled by clangd and not clang?
Is my invocation correct or is this case handled by clangd and not clang?
yeah your invocation is correct. this is because clang's printer does a prefix based filtering (while clangd does a fuzzy match) https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/CodeCompleteConsumer.cpp#L623.
clang/test/CodeCompletion/overrides.cpp | ||
---|---|---|
36 | no need for -code-completion-patterns. can you also move the new test case below (after CHECK-CC3-NOT) that way we get to keep the line numbers for old tests the same. |
That would be great, thanks
clang/test/CodeCompletion/overrides.cpp | ||
---|---|---|
36 | I put the test in between because anything after vf on line 14 gives an error. error: unknown type name 'vf' vf ^ It still outputs the correct completions but since the return code is non-zero, FileCheck fails | |
36 | I've found from one of the others tests it is possible to invert the return code from clang. |
i think the importance of ordering requires a comment here, maybe something like:
Class context can appear inside a function/block, so prioritise that.