This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Extend findTarget()'s dependent name heuristic to handle enumerators
ClosedPublic

Authored by nridge on Mar 12 2020, 3:23 PM.

Diff Detail

Event Timeline

nridge created this revision.Mar 12 2020, 3:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 12 2020, 3:23 PM

Thanks! Just a couple of Qs...

clang-tools-extra/clangd/FindTarget.cpp
88

Is this the bit that "breaks" the dependence? getDecl() works even if the type might ultimately correspond to a different decl?

It's not obvious to me where the magic happens, so wherever it is, maybe add a comment :-)

88

The actual lookup doesn't do anything subtle in this case (no dependent base lookup, failing to match IsArrow isn't possible).

What do you think about just calling Decl->lookup() here and early returning, not bothering with the generalization of lookupDependentName? (I find the mix of behavior in that function a little hard to get my head around)

nridge updated this revision to Diff 250863.Mar 17 2020, 12:35 PM
nridge marked 2 inline comments as done.

Address review comments

sammccall accepted this revision.Mar 17 2020, 2:24 PM

Thanks!

clang-tools-extra/clangd/FindTarget.cpp
82

or auto result = ET->getDecl()->lookup(...); return {result.begin(), result.end()}

This revision is now accepted and ready to land.Mar 17 2020, 2:24 PM
nridge updated this revision to Diff 250922.Mar 17 2020, 3:08 PM
nridge marked an inline comment as done.

Address final review comment

This revision was automatically updated to reflect the committed changes.