This is an archive of the discontinued LLVM Phabricator instance.

[AST][RecoveryExpr] Preserve type for broken member call expr.
ClosedPublic

Authored by hokein on May 18 2020, 1:09 AM.

Diff Detail

Event Timeline

hokein created this revision.May 18 2020, 1:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2020, 1:09 AM
hokein marked an inline comment as done.May 18 2020, 1:54 AM
hokein added inline comments.
clang/lib/Sema/SemaOverload.cpp
14324

It is a bit sad that the broken function call cases (too many/few agguments) are failing into this group, all candidates are not viable -- this means we don't get any benefits (no Best), for some cases, it is suboptimal even though the best candidate looks like obvious.

class Collection {
  const char *find(int) const;
  char* find(int);
};
void test1(const Collection &C) {
 C.find(); // we want const char*, but all overloads are not viable and return types are not the same, so no type captured here.
}
sammccall accepted this revision.May 18 2020, 10:03 AM
sammccall added inline comments.
clang/lib/Sema/SemaOverload.cpp
14303

seems like bool Success = false would be a "safer" default and have to be set in fewer places

14324

Yeah, at some point we can add more heuristics (discard non-viable or hidden functions using heuristics) to handle this case, like I did in SemaCodeComplete...

14347

resolvation -> resolution

clang/test/AST/ast-dump-recovery.cpp
143

why does this not work?
isn't there only one candidate, so chooseRecoveryType should pick it?

This revision is now accepted and ready to land.May 18 2020, 10:03 AM

@hokein Did this get landed at some point?

hokein updated this revision to Diff 308267.Nov 29 2020, 11:56 PM

rebase and address comments.

hokein marked 2 inline comments as done.Nov 30 2020, 12:01 AM

sorry for the delay, picking it up now.

clang/lib/Sema/SemaCoroutine.cpp
864 ↗(On Diff #308267)

we need this change to prevent a regression on co_await-range-for.

without this change, we will emit 2 call to deleted member function 'await_transform' diagnostics on https://github.com/llvm/llvm-project/blob/master/clang/test/SemaCXX/co_await-range-for.cpp#L52-L54.

clang/test/AST/ast-dump-recovery.cpp
143

this is on a different codepath, will fix in https://reviews.llvm.org/D92298

This revision was landed with ongoing or failed builds.Dec 13 2020, 11:51 PM
This revision was automatically updated to reflect the committed changes.