This is an archive of the discontinued LLVM Phabricator instance.

[CodeComplete] Member completion: heuristically resolve some dependent base exprs
ClosedPublic

Authored by sammccall on Feb 9 2021, 3:11 PM.

Details

Summary

Today, inside a template, you can get completion for:

Foo<T> t;
t.^

t has dependent type Foo<T>, and we use the primary template to find its members.
However we also want this to work:

t.foo.bar().^

The type of t.foo.bar() is DependentTy, so we attempt to resolve using similar
heuristics (e.g. primary template).

Diff Detail

Event Timeline

sammccall created this revision.Feb 9 2021, 3:11 PM
sammccall requested review of this revision.Feb 9 2021, 3:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2021, 3:11 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall updated this revision to Diff 322681.Feb 10 2021, 7:25 AM

Also handle parens and unresolved calls

hokein accepted this revision.Feb 10 2021, 11:44 PM

thanks! this looks like a nice improvement!

clang/test/CodeCompletion/member-access.cpp
88

hmm, inserting new code here will shift all offsets of below code, I would append a new test in this file to keep a clearer history. but up to you.

This revision is now accepted and ready to land.Feb 10 2021, 11:44 PM
sammccall added inline comments.Feb 11 2021, 2:03 AM
clang/test/CodeCompletion/member-access.cpp
88

I see your point about history, but I find myself navigating these tests by semantics more often than by history, and this seems closely related to the existing completeDependentMembers cases.

This revision was landed with ongoing or failed builds.Feb 11 2021, 2:03 AM
This revision was automatically updated to reflect the committed changes.