This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Only report explicitly typed symbols during code navigation
ClosedPublic

Authored by kadircet on Feb 21 2019, 2:13 AM.

Details

Summary

Clangd was reporting implicit symbols, like results of implicit cast
expressions during code navigation, which is not desired. For example:

struct Foo{ Foo(int); };
void bar(Foo);
vod foo() {
  int x;
  bar(^x);
}

Performing a GoTo on the point specified by ^ would give two results one
pointing to line int x and the other for definition of Foo(int);

Diff Detail

Event Timeline

kadircet created this revision.Feb 21 2019, 2:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2019, 2:13 AM
ilya-biryukov accepted this revision.Feb 21 2019, 2:41 AM
ilya-biryukov added a reviewer: hokein.
ilya-biryukov marked an inline comment as done.

Haojian is the author, so adding him as a reviewer. LGTM from my side

unittests/clangd/XRefsTests.cpp
416

Does that mean we're not showing constructor results in:

X foo^(something);

It's the only thing that I would miss. OTOH, I also think it should be attached to the parentheses and it's not the case now.

Anyhow, not a huge deal.

This revision is now accepted and ready to land.Feb 21 2019, 2:41 AM

+1 on removing the implicit references, sometimes it gives very confusing results.

clangd/XRefs.cpp
112–113

This structure is not used anymore, remove it.

115–116

The comment is stale.

unittests/clangd/XRefsTests.cpp
465–468

Can we add one more testcase?

Foo ab^c;
472–473

The comment is stale.

kadircet updated this revision to Diff 187778.Feb 21 2019, 6:14 AM
kadircet marked 2 inline comments as done.
  • Add more test cases
  • Get rid of number of parameters check in implicitness control
kadircet marked 2 inline comments as done.Feb 21 2019, 6:15 AM
kadircet added inline comments.
unittests/clangd/XRefsTests.cpp
472–473

No more

hokein accepted this revision.Feb 21 2019, 6:38 AM
hokein added inline comments.
unittests/clangd/XRefsTests.cpp
462

nit: keep the number in sort.

483

s/calss/class

kadircet updated this revision to Diff 187786.Feb 21 2019, 6:46 AM
kadircet marked 2 inline comments as done.
  • Address comments
This revision was automatically updated to reflect the committed changes.