summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/SemanticHighlighting.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2019-09-24 11:14:06 +0000
committerHaojian Wu <hokein@google.com>2019-09-24 11:14:06 +0000
commit7e3c74bc63f97dd8fa354e6f2153ab8b3d88082a (patch)
tree1df37fa5f202189bd8b4a3cf4498f18e6fb79c56 /clang-tools-extra/clangd/SemanticHighlighting.cpp
parent6bac09afe89f7db8e6d4951d66d127d048c91dab (diff)
downloadbcm5719-llvm-7e3c74bc63f97dd8fa354e6f2153ab8b3d88082a.tar.gz
bcm5719-llvm-7e3c74bc63f97dd8fa354e6f2153ab8b3d88082a.zip
[clangd] Collect macros in the preamble region of the main file
Summary: - store all macro references in the ParsedAST; - unify the two variants of CollectMainFileMacros; Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67496 llvm-svn: 372725
Diffstat (limited to 'clang-tools-extra/clangd/SemanticHighlighting.cpp')
-rw-r--r--clang-tools-extra/clangd/SemanticHighlighting.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index ce846141aca..9790f8b898e 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -110,8 +110,9 @@ public:
TraverseAST(AST.getASTContext());
// Add highlightings for macro expansions as they are not traversed by the
// visitor.
- for (SourceLocation Loc : AST.getMacros())
- addToken(Loc, HighlightingKind::Macro);
+ for (const auto &M : AST.getMacros().Ranges)
+ Tokens.push_back({HighlightingKind::Macro, M});
+ // addToken(Loc, HighlightingKind::Macro);
// Initializer lists can give duplicates of tokens, therefore all tokens
// must be deduplicated.
llvm::sort(Tokens);
OpenPOWER on IntegriCloud