[PATCH] D38425: [clangd] Document highlights for clangd

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 27 12:50:16 PST 2017


malaperle requested changes to this revision.
malaperle added a comment.
This revision now requires changes to proceed.

I tested the patch and it works quite well! I think those are the last comments from me. Sorry, I should have bundled them together a bit more :(



================
Comment at: clangd/ClangdUnit.cpp:1019
+  const ASTContext *
+  Preprocessor &PP;
+
----------------
Not used.


================
Comment at: clangd/ClangdUnit.cpp:1029
+    std::sort(DocumentHighlights.begin(), DocumentHighlights.end());
+    auto last =
+        std::unique(DocumentHighlights.begin(), DocumentHighlights.end());
----------------
Last


================
Comment at: clangd/ClangdUnit.cpp:1069
+    SourceLocation LocEnd =
+        Lexer::getLocForEndOfToken(SR.getEnd(), 0, SourceMgr, LangOpts);
+    Position Begin;
----------------
Don't call getLocForEndOfToken here again. This is the reason why sometimes it includes an extra character. Just to explain a bit, supposed we have
int Foo;

the first call to getLocForEnd in handleDeclOccurence will compute the position at
int Foo|;
Then if you call is again, it will go at the end of the ';' token so it will now be
int Foo;|



Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D38425





More information about the cfe-commits mailing list