This is an archive of the discontinued LLVM Phabricator instance.

[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.
ClosedPublic

Authored by sammccall on May 29 2019, 5:59 AM.

Details

Summary
  • when a method is not available because of the target value kind (e.g. an && method on a Foo& variable), then don't offer it.
  • when a method is effectively shadowed by another method from the same class with a) an identical argument list and b) superior qualifiers, then don't offer it.

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.May 29 2019, 5:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2019, 5:59 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall updated this revision to Diff 201910.May 29 2019, 7:10 AM

Remove debug

ilya-biryukov added inline comments.May 29 2019, 8:47 AM
lib/Sema/SemaCodeComplete.cpp
1300 ↗(On Diff #201910)

Won't this crash on Method->getName()? Could we add a test for that?
Completing in a class that has a user-defined operator==() would probably do the trick.

1308 ↗(On Diff #201910)

Could you add a comment that we modify previously added results here?
It's obvious from the code, but not something I would normally expect so having a separate comment looks useful.

sammccall updated this revision to Diff 202441.May 31 2019, 8:29 AM
sammccall marked 2 inline comments as done.

Handle methods without "normal" identifier names.
Add comments.
Trigger in both directions (dominated and dominated-by).

Oops, we weren't handling the case when the newly-added overload is dominated by an existing one. Fixed.

lib/Sema/SemaCodeComplete.cpp
1300 ↗(On Diff #201910)

Right! Fixed and test added. We now no longer hash the strings which is nice too.

ilya-biryukov accepted this revision.Jun 3 2019, 2:00 AM

LGTM

lib/Sema/SemaCodeComplete.cpp
1314 ↗(On Diff #202441)

A leftover debug output. Please remove before landing

This revision is now accepted and ready to land.Jun 3 2019, 2:00 AM
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2019, 2:43 AM