This patch mostly reverts D74850.
We could not use AST.getTokens() here, because it does not have tokens from the preamble.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
ah embarrassing :/ thanks for catching this! It should've been obvious from the fact that there's a "FilePath" and a "TUPath" going on ..
clang-tools-extra/clangd/XRefs.cpp | ||
---|---|---|
1191 | let's rename it to DeclRange rather than NameRange. | |
clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp | ||
550 | you can keep using the TestTU. just provide the header via AdditionalFiles and TU.build should first build a preamble and use it. That way you can get rid of additions to the SyncAPI and usage of ClangdServer in here. |
LGTM, just some improvements to the testing. also please let me know if I should land this for you.
clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp | ||
---|---|---|
533 | this doesn't need to be an Annotation and sorry for missing it in the first pass but since this only has a single header, you can actually do something like: TestTU TU = TestTU::withCode(SourceAnnotations.code()); TU.HeaderCode = "struct Parent { int a; }"; and also drop the include directive in SourceAnnotations as TU.HeaderCode is implicitly included. | |
548 | could you also make sure selection range is correct at least for Parent (as main file ranges are tested elsewhere already), so that we don't regress it in the future. |
Yes, could you please land this for me? I do not have commit access.
Aleksandr Platonov <platonov.aleksandr@huawei.com>
clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp | ||
---|---|---|
533 | right, you need annotations for the range, but you still can get away with just setting TU.HeaderCode instead of populating AdditionalFiles and including the header in the source. but not that important. |
clang-tools-extra/clangd/unittests/TypeHierarchyTests.cpp | ||
---|---|---|
533 | Thanks. fixed |
let's rename it to DeclRange rather than NameRange.