[PATCH] D95852: [clangd] Report xref for base methods.

Utkarsh Saxena via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 06:40:47 PST 2021


usaxena95 added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:1902
+        void test(BaseBase* BB, Base* B, Derived* D) {
+          BB->func();  // refs to base's base method are not reported.
+          B->[[func]]();  // References to the base method.
----------------
hokein wrote:
> ah, this is a good case!  I think we should include the base's base method as part of the refs -- because BB->func() can actually call D::func if BB points to a `Derived` object.
> 
> the fix is to add ids from `overridden_methods` recursively.
> 
Yeah we can do that. Although I had intentionally left those out considering the number of references would increase significantly if we do it for the complete type hierarchy. Also since LSP doesn't provide a way to annotate these kind of references, it would be hard for users to find exact refs (to Derived::foo()).
WDYT ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95852/new/

https://reviews.llvm.org/D95852



More information about the cfe-commits mailing list