It is possible to write include code from other files so that the decls from there do not become topLevelDecls (For example by including methods for a class). These Decls are not filtered by topLevelDecls and therefore SemanticHighlighting must manually check that every SLoc belongs in the main file. Otherwise there can be highlightings appearing in places where they should not.
Details
Details
- Reviewers
hokein ilya-biryukov - Commits
- rGcbe3ed552fa8: [clangd] Remove highlightings coming from non topLevelDecls from included files.
rCTE368563: [clangd] Remove highlightings coming from non topLevelDecls from included files.
rL368563: [clangd] Remove highlightings coming from non topLevelDecls from included files.
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM. Great example for the test case! It will definitely stay valid even if we fix all problems caused by RecursiveASTVisitor!
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
236 ↗ | (On Diff #214608) | nit: the ) is not match. |
237 ↗ | (On Diff #214608) | nit: clangd has its own isInsideMainFile, please use it. |
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp | ||
57 ↗ | (On Diff #214608) | nit: maybe just std::vector<std::pair</*FileName*/llvm::StringRef, /*FileContent*/llvm::StringRef>>, it is clearer and would save you a long comment above. |