On Mon, Jul 15, 2013 at 12:54 PM, Kaelyn Uhrain <span dir="ltr"><<a href="mailto:rikka@google.com" target="_blank">rikka@google.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: rikka<br>
Date: Mon Jul 15 14:54:54 2013<br>
New Revision: 186342<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=186342&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=186342&view=rev</a><br>
Log:<br>
Move the "->" to "." fixit from r186128 into a separate note since<br>
recovery is not attempted with the fixit. Also move the associated test<br>
case from FixIt/fixit.cpp to SemaCXX/member-expr.cpp since the fixit is<br>
no longer automatically applied.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
cfe/trunk/lib/Sema/SemaOverload.cpp<br>
cfe/trunk/test/FixIt/fixit.cpp<br>
cfe/trunk/test/SemaCXX/member-expr.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=186342&r1=186341&r2=186342&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=186342&r1=186341&r2=186342&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 15 14:54:54 2013<br>
@@ -4241,6 +4241,8 @@ def err_typecheck_member_reference_arrow<br>
"member reference type %0 is not a pointer">;<br>
def err_typecheck_member_reference_suggestion : Error<<br>
"member reference type %0 is %select{a|not a}1 pointer; maybe you meant to use '%select{->|.}1'?">;<br>
+def note_typecheck_member_reference_suggestion : Note<<br>
+ "did you meant to use '.' instead?">;<br></blockquote><div><br></div><div>did you mean "did you mean"?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
def err_typecheck_member_reference_type : Error<<br>
"cannot refer to type member %0 in %1 with '%select{.|->}2'">;<br>
def err_typecheck_member_reference_unknown : Error<<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=186342&r1=186341&r2=186342&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=186342&r1=186341&r2=186342&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Jul 15 14:54:54 2013<br>
@@ -11355,13 +11355,11 @@ Sema::BuildOverloadedArrowExpr(Scope *S,<br>
case OR_No_Viable_Function:<br>
if (CandidateSet.empty()) {<br>
QualType BaseType = Base->getType();<br>
+ Diag(OpLoc, diag::err_typecheck_member_reference_arrow)<br>
+ << BaseType << Base->getSourceRange();<br>
if (BaseType->isRecordType() && !BaseType->isPointerType()) {<br>
- Diag(OpLoc, diag::err_typecheck_member_reference_suggestion)<br>
- << BaseType << 1 << Base->getSourceRange()<br>
+ Diag(OpLoc, diag::note_typecheck_member_reference_suggestion)<br>
<< FixItHint::CreateReplacement(OpLoc, ".");<br>
- } else {<br>
- Diag(OpLoc, diag::err_typecheck_member_reference_arrow)<br>
- << BaseType << Base->getSourceRange();<br>
}<br>
} else<br>
Diag(OpLoc, diag::err_ovl_no_viable_oper)<br>
<br>
Modified: cfe/trunk/test/FixIt/fixit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=186342&r1=186341&r2=186342&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=186342&r1=186341&r2=186342&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/FixIt/fixit.cpp (original)<br>
+++ cfe/trunk/test/FixIt/fixit.cpp Mon Jul 15 14:54:54 2013<br>
@@ -313,18 +313,6 @@ namespace PR5066 {<br>
X<int *p> x; // expected-error {{type-id cannot have a name}}<br>
}<br>
<br>
-namespace PR15045 {<br>
- class Cl0 {<br>
- public:<br>
- int a;<br>
- };<br>
-<br>
- int f() {<br>
- Cl0 c;<br>
- return c->a; // expected-error {{member reference type 'PR15045::Cl0' is not a pointer; maybe you meant to use '.'?}}<br>
- }<br>
-}<br>
-<br>
namespace PR5898 {<br>
class A {<br>
public:<br>
<br>
Modified: cfe/trunk/test/SemaCXX/member-expr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-expr.cpp?rev=186342&r1=186341&r2=186342&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-expr.cpp?rev=186342&r1=186341&r2=186342&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaCXX/member-expr.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/member-expr.cpp Mon Jul 15 14:54:54 2013<br>
@@ -87,7 +87,8 @@ namespace test5 {<br>
}<br>
<br>
void test2(A &x) {<br>
- x->A::foo<int>(); // expected-error {{'test5::A' is not a pointer}}<br>
+ x->A::foo<int>(); // expected-error {{'test5::A' is not a pointer}} \<br>
+ // expected-note {{did you meant to use '.' instead?}}<br>
}<br>
}<br>
<br>
@@ -172,3 +173,16 @@ void f(int i) {<br>
j = 0;<br>
}<br>
}<br>
+<br>
+namespace PR15045 {<br>
+ class Cl0 {<br>
+ public:<br>
+ int a;<br>
+ };<br>
+<br>
+ int f() {<br>
+ Cl0 c;<br>
+ return c->a; // expected-error {{member reference type 'PR15045::Cl0' is not a pointer}} \<br>
+ // expected-note {{did you meant to use '.' instead?}}<br>
+ }<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br>