[PATCH v3 9/9] Wire up LookupMemberExpr to use the new TypoExpr.

Richard Smith richard at metafoo.co.uk
Fri Jul 25 15:03:14 PDT 2014


+  if (TE && SemaRef.getLangOpts().CPlusPlus) {
+    // TODO: C cannot handle TypoExpr nodes because the C code paths do
not know
+    // what to do with dependent types e.g. on the LHS of an assigment.
+    *TE = SemaRef.CorrectTypoDelayed(

Does this recover correctly if CorrectTypoDelayed returns nullptr? I'd have
expected that you should carry on and produce an error in this case.


+        SemaRef.AddMethodCandidate(
+            DeclAccessPair::make(ND, AS_none),
BaseType.getNonReferenceType(),
+
 /*MemberRef.get()->Classify(SemaRef.Context)*/Expr::Classification::makeSimpleLValue(),
Args, CandidateSet);

Commented-out code?


+      // Perform overload resolution.
+      OverloadCandidateSet::iterator Best;
+      auto result = CandidateSet.BestViableFunction(
+          SemaRef, CE->getLocStart(), Best);

Do you need to do this here? Can you instead simply build an unresolved
overload set and allow the TreeTransform to do overload resolution when it
transforms the parent, or is there some subtlety that makes this necessary?


+  something(obj.toobat,   // expected-error {{did you mean 'foobar'?}}
+            obj.toobat);  // expected-error {{did you mean 'toobad'?}}

I love this testcase =)


On Mon, Jul 14, 2014 at 4:55 PM, Kaelyn Takata <rikka at google.com> wrote:

>
> This includes adding the new TypoExpr-based lazy typo correction to
> LookupMemberExprInRecord as an alternative to the existing eager typo
> correction.
> ---
>  lib/Sema/SemaExprMember.cpp              | 149
> +++++++++++++++++++++++++++++--
>  test/SemaCXX/arrow-operator.cpp          |   5 +-
>  test/SemaCXX/typo-correction-delayed.cpp |  32 +++++++
>  test/SemaCXX/typo-correction-pt2.cpp     |   2 +-
>  test/SemaCXX/typo-correction.cpp         |  10 +--
>  5 files changed, 182 insertions(+), 16 deletions(-)
>  create mode 100644 test/SemaCXX/typo-correction-delayed.cpp
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140725/211924c4/attachment.html>


More information about the cfe-commits mailing list