This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Extend find-refs to include overrides.
ClosedPublic

Authored by hokein on Jan 11 2021, 12:48 AM.

Details

Summary

find-references on virtual void meth^od() = 0 will include override references.

Diff Detail

Event Timeline

hokein created this revision.Jan 11 2021, 12:48 AM
hokein requested review of this revision.Jan 11 2021, 12:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2021, 12:48 AM
usaxena95 accepted this revision.Jan 11 2021, 11:36 AM

LG. Thanks!

clang-tools-extra/clangd/XRefs.cpp
1335

nit: s/OverrideSymbols/Overrides

clang-tools-extra/clangd/unittests/XRefsTests.cpp
1848

nit: May be include tests for CRTP too.

This revision is now accepted and ready to land.Jan 11 2021, 11:36 AM
njames93 added a subscriber: njames93.EditedJan 11 2021, 12:03 PM

Should we be providing virtual method overrides when finding references, surely that's what query implementations is for?

nridge added a subscriber: nridge.Jan 17 2021, 2:45 PM
hokein updated this revision to Diff 317832.Jan 20 2021, 4:21 AM
hokein marked an inline comment as done.

address review comment.

Should we be providing virtual method overrides when finding references, surely that's what query implementations is for?

yeah, go-to-implementation is designed for this purpose. However, not every LSP-client would expose a UI for go-to-implementation, we want to surface these results for these clients as well via other common features like go-to-def, find-references, hover etc.

clang-tools-extra/clangd/unittests/XRefsTests.cpp
1848

I think CRTP is about class inheritance, while in this patch we just handle virtual methods which seems not related to CRTP.

This revision was landed with ongoing or failed builds.Jan 20 2021, 4:26 AM
This revision was automatically updated to reflect the committed changes.