This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Factor out some helper functions related to heuristic resolution in TargetFinder
ClosedPublic

Authored by nridge on Jul 7 2020, 11:57 PM.

Details

Summary

Two helpers are introduced:

  • Some of the logic previously in TargetFinder::Visit*() methods is factored out into resolveDependentExprToDecls().
  • Some of the logic in getMembersReferencedViaDependentName() is factored out into resolveTypeToRecordDecl().

D82739 will build on this and use these functions in new ways.

Diff Detail

Event Timeline

nridge created this revision.Jul 7 2020, 11:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2020, 11:57 PM
nridge updated this revision to Diff 276321.Jul 8 2020, 12:06 AM

Improve patch split

hokein accepted this revision.Jul 8 2020, 7:56 AM

thanks, looks good.

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

nit: add assert(T), or even use const Type& as the parameter type.

159

nit: add assert(E->isTypeDepndent());

160

nit: looks like the code will be a bit simpler if we just use if branch like

if (const auto * a = dyn_cast<XX>(xxxx));

but up to you.

This revision is now accepted and ready to land.Jul 8 2020, 7:56 AM
nridge updated this revision to Diff 276911.Jul 9 2020, 10:26 PM
nridge marked 3 inline comments as done.

Address review comments

This revision was automatically updated to reflect the committed changes.