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

William Enright via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 13:55:34 PDT 2017

Nebiroth marked an inline comment as done.
Nebiroth added inline comments.

Comment at: clangd/ClangdUnit.cpp:784
+/// Finds declarations locations that a given source location refers to.
+class TargetDeclarationFinder : public index::IndexDataConsumer {
+  std::vector<Location> DeclarationLocations;
ilya-biryukov wrote:
> This `IndexDataConsumer` effectively does the same thing as `DeclarationLocationsFinder`.
> We should reuse the code between those two.
> To do that we could:
> 1. Change `DeclarationLocationsFinder` to return a list of `Decl*`s and `MacroDef*`s that are under caret.
> 2. In `findDefinition` we should return locations of found `Decl` and `MacroDef`.
> 3. In `documentHighlights` we would rerun `DocumentHighlightsFinder`to capture locations of `Decls` referenced in step 1.
> Do you think this approach would work?
I have something similar to this implemented. Will upstream it soon.


More information about the cfe-commits mailing list