[PATCH] D64747: [clangd] Skip implicit nodes when traversing for highlightings
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 15 08:00:18 PDT 2019
ilya-biryukov created this revision.
ilya-biryukov added reviewers: jvikstrom, hokein.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.
Herald added a project: clang.
Implicit code adds corner cases to handle and does not provide any value
as those nodes cannot be mapped back to source text.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D64747
Files:
clang-tools-extra/clangd/SemanticHighlighting.cpp
Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===================================================================
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -28,6 +28,10 @@
HighlightingTokenCollector(ParsedAST &AST)
: Ctx(AST.getASTContext()), SM(AST.getSourceManager()) {}
+ // Only highlight nodes that map to source code, skip implicitly generated
+ // code.
+ bool shouldVisitImplicitCode() const { return false; }
+
std::vector<HighlightingToken> collectTokens() {
Tokens.clear();
TraverseAST(Ctx);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64747.209866.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190715/6156e7bb/attachment.bin>
More information about the cfe-commits
mailing list