See: https://github.com/clangd/clangd/issues/668
struct A { virtual void foo(); }; struct B : A { void foo() override; };
Find refs on A::foo() will show:
- decls of A::foo()
- decls of B::foo()
- refs to A::foo()
- no refs to B::foo().
Paths
| Differential D95812
[clangd] Report only decl of overridding method in xref. ClosedPublic Authored by usaxena95 on Feb 1 2021, 12:23 PM.
Details Summary See: https://github.com/clangd/clangd/issues/668 struct A { virtual void foo(); }; struct B : A { void foo() override; }; Find refs on A::foo() will show:
Diff Detail
Event TimelineComment Actions This looks about right to me... The first of those patches introduces flags on returned refs to indicate which are decls/defs. I'd suggest adding an "override" flag and populating it for these results. (I guess the bug includes the other side of this, where if the method is an override, calls to base methods are reported. Makes sense to split it into a separate patch...) Comment Actions
Thanks.
Yes. I plan to do that in a separate patch. This revision is now accepted and ready to land.Feb 1 2021, 11:43 PM This revision was landed with ongoing or failed builds.Feb 2 2021, 4:06 AM Closed by commit rGfbeff2ec2bc6: [clangd] Report only decl of overridding method in xref. (authored by usaxena95). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 320743 clang-tools-extra/clangd/XRefs.h
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/unittests/XRefsTests.cpp
|
nit: add some doc, I'd just name it override as this field indicates this is an occurrence overrides the base method.