[PATCH] D38425: [clangd] Document highlights for clangd
Marc-Andre Laperle via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 23 09:02:08 PST 2017
malaperle added inline comments.
================
Comment at: clangd/ClangdUnit.cpp:1245
+
+ for (unsigned I = 0; I < DocHighlightsFinder->getSourceRanges().size(); I++) {
+ HighlightLocations.push_back(
----------------
malaperle wrote:
> replace all this code (1242-1265) by moving it in DocumentHighlightsFinder? then call takeHighlights.
Also, use a range-based for loop
================
Comment at: clangd/ClangdUnit.cpp:1247
+ HighlightLocations.push_back(
+ addHighlightLocation(AST, DocHighlightsFinder->getSourceRanges()[I],
+ DocHighlightsFinder->getKinds()[I]));
----------------
The vector returned by getKinds() doesn't match the size of getSourceRanges(). This is because the kinds vector is computed in DeclarationLocationsFinder which only computes the kind of the occurrence the user has selected, not the kinds of all occurrences for a given Decl. Once you move the code to create the highlights in DocumentHighlightsFinder, you won't need a vector of kinds and this won't be a problem.
https://reviews.llvm.org/D38425
More information about the cfe-commits
mailing list