r186342 - Move the "->" to "." fixit from r186128 into a separate note since

Kaelyn Uhrain rikka at google.com
Mon Jul 15 14:20:13 PDT 2013


On Mon, Jul 15, 2013 at 12:59 PM, Richard Smith <richard at metafoo.co.uk>wrote:

> On Mon, Jul 15, 2013 at 12:54 PM, Kaelyn Uhrain <rikka at google.com> wrote:
>
>> Author: rikka
>> Date: Mon Jul 15 14:54:54 2013
>> New Revision: 186342
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=186342&view=rev
>> Log:
>> Move the "->" to "." fixit from r186128 into a separate note since
>> recovery is not attempted with the fixit. Also move the associated test
>> case from FixIt/fixit.cpp to SemaCXX/member-expr.cpp since the fixit is
>> no longer automatically applied.
>>
>> Modified:
>>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>     cfe/trunk/lib/Sema/SemaOverload.cpp
>>     cfe/trunk/test/FixIt/fixit.cpp
>>     cfe/trunk/test/SemaCXX/member-expr.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=186342&r1=186341&r2=186342&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 15
>> 14:54:54 2013
>> @@ -4241,6 +4241,8 @@ def err_typecheck_member_reference_arrow
>>    "member reference type %0 is not a pointer">;
>>  def err_typecheck_member_reference_suggestion : Error<
>>    "member reference type %0 is %select{a|not a}1 pointer; maybe you
>> meant to use '%select{->|.}1'?">;
>> +def note_typecheck_member_reference_suggestion : Note<
>> +  "did you meant to use '.' instead?">;
>>
>
> did you mean "did you mean"?
>

D'oh! Yes I did mean "mean". Fixed in r186348.

>
>
>>  def err_typecheck_member_reference_type : Error<
>>    "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
>>  def err_typecheck_member_reference_unknown : Error<
>>
>> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=186342&r1=186341&r2=186342&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Jul 15 14:54:54 2013
>> @@ -11355,13 +11355,11 @@ Sema::BuildOverloadedArrowExpr(Scope *S,
>>    case OR_No_Viable_Function:
>>      if (CandidateSet.empty()) {
>>        QualType BaseType = Base->getType();
>> +      Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
>> +        << BaseType << Base->getSourceRange();
>>        if (BaseType->isRecordType() && !BaseType->isPointerType()) {
>> -        Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)
>> -          << BaseType << 1 << Base->getSourceRange()
>> +        Diag(OpLoc, diag::note_typecheck_member_reference_suggestion)
>>            << FixItHint::CreateReplacement(OpLoc, ".");
>> -      } else {
>> -        Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
>> -          << BaseType << Base->getSourceRange();
>>        }
>>      } else
>>        Diag(OpLoc, diag::err_ovl_no_viable_oper)
>>
>> Modified: cfe/trunk/test/FixIt/fixit.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=186342&r1=186341&r2=186342&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/FixIt/fixit.cpp (original)
>> +++ cfe/trunk/test/FixIt/fixit.cpp Mon Jul 15 14:54:54 2013
>> @@ -313,18 +313,6 @@ namespace PR5066 {
>>    X<int *p> x; // expected-error {{type-id cannot have a name}}
>>  }
>>
>> -namespace PR15045 {
>> -  class Cl0 {
>> -  public:
>> -    int a;
>> -  };
>> -
>> -  int f() {
>> -    Cl0 c;
>> -    return c->a;  // expected-error {{member reference type
>> 'PR15045::Cl0' is not a pointer; maybe you meant to use '.'?}}
>> -  }
>> -}
>> -
>>  namespace PR5898 {
>>    class A {
>>    public:
>>
>> Modified: cfe/trunk/test/SemaCXX/member-expr.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-expr.cpp?rev=186342&r1=186341&r2=186342&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/member-expr.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/member-expr.cpp Mon Jul 15 14:54:54 2013
>> @@ -87,7 +87,8 @@ namespace test5 {
>>    }
>>
>>    void test2(A &x) {
>> -    x->A::foo<int>(); // expected-error {{'test5::A' is not a pointer}}
>> +    x->A::foo<int>(); // expected-error {{'test5::A' is not a pointer}} \
>> +                      // expected-note {{did you meant to use '.'
>> instead?}}
>>    }
>>  }
>>
>> @@ -172,3 +173,16 @@ void f(int i) {
>>    j = 0;
>>  }
>>  }
>> +
>> +namespace PR15045 {
>> +  class Cl0 {
>> +  public:
>> +    int a;
>> +  };
>> +
>> +  int f() {
>> +    Cl0 c;
>> +    return c->a;  // expected-error {{member reference type
>> 'PR15045::Cl0' is not a pointer}} \
>> +                  // expected-note {{did you meant to use '.' instead?}}
>> +  }
>> +}
>>
>>
>> _______________________________________________
>> 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/20130715/0b1e3455/attachment.html>


More information about the cfe-commits mailing list