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.


https://reviews.llvm.org/D38425



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to