This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Handle template arguments in findExplicitReferences
ClosedPublic

Authored by ilya-biryukov on Sep 27 2019, 6:06 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ilya-biryukov created this revision.Sep 27 2019, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 27 2019, 6:06 AM
ilya-biryukov added inline comments.Sep 27 2019, 6:09 AM
clang-tools-extra/clangd/FindTarget.cpp
576 ↗(On Diff #222157)

This comment is a bit unclear, I'll have to change it.
The idea is that this is handled by VisitType and VisitExpression

kadircet added inline comments.Sep 30 2019, 5:13 AM
clang-tools-extra/clangd/FindTarget.cpp
556 ↗(On Diff #222157)

... and we need it because, template template decls are visited through it ?

567 ↗(On Diff #222157)

I suppose these corresponds to non-type template paramters, don't they? (which should make it similar to integral case)

618 ↗(On Diff #222157)

can we keep dlog ?

clang-tools-extra/clangd/unittests/FindTargetTests.cpp
751 ↗(On Diff #222157)

can you also name the template param, add a reference in wrapper and check for it ?

ilya-biryukov marked 6 inline comments as done.Oct 1 2019, 12:52 AM
ilya-biryukov added inline comments.
clang-tools-extra/clangd/FindTarget.cpp
556 ↗(On Diff #222157)

Yes, exactly. Amended this to the comment.

567 ↗(On Diff #222157)

Yes, e.g. see the wrapper<func> example from the tests.
However, these arguments seem to be stored and visited as expressions in the TemplateArgumentLoc.

IIUC, Declaration can only happen in template arguments outside TemplateArgumentLoc.

618 ↗(On Diff #222157)

I've initially removed it to avoid passing DynTypedNode to reportReference, but I also agree this dlog is useful.

So making the function signature a bit clunky for the sake of debug logging

ilya-biryukov marked 2 inline comments as done.
  • Restore dlog()
  • Check reference to function pointer non-type template parameters in tests
  • Extend comment of TraverseTemplateArgumentLoc
kadircet accepted this revision.Oct 1 2019, 2:33 AM

LGTM, thanks!

This revision is now accepted and ready to land.Oct 1 2019, 2:33 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 1 2019, 3:01 AM