[cfe-commits] r66635 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def test/SemaObjC/bad-receiver-1.m test/SemaObjC/message.m test/SemaObjC/super.m

Chris Lattner sabre at nondot.org
Tue Mar 10 20:47:47 PDT 2009


Author: lattner
Date: Tue Mar 10 22:47:47 2009
New Revision: 66635

URL: http://llvm.org/viewvc/llvm-project?rev=66635&view=rev
Log:
Improve the "bad receiver" warning for ObjC message sends to be less confusing.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
    cfe/trunk/test/SemaObjC/bad-receiver-1.m
    cfe/trunk/test/SemaObjC/message.m
    cfe/trunk/test/SemaObjC/super.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def?rev=66635&r1=66634&r2=66635&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Tue Mar 10 22:47:47 2009
@@ -982,7 +982,7 @@
 DIAG(err_invalid_receiver_to_message, ERROR,
      "invalid receiver to message expression")
 DIAG(warn_bad_receiver_type, WARNING,
-     "bad receiver type %0")
+     "receiver type %0 is not 'id' or Objective-C interface pointer, consider casting it to 'id'")
 DIAG(err_bad_receiver_type, ERROR,
      "bad receiver type %0")
 DIAG(error_objc_throw_expects_object, ERROR,

Modified: cfe/trunk/test/SemaObjC/bad-receiver-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/bad-receiver-1.m?rev=66635&r1=66634&r2=66635&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/bad-receiver-1.m (original)
+++ cfe/trunk/test/SemaObjC/bad-receiver-1.m Tue Mar 10 22:47:47 2009
@@ -5,7 +5,7 @@
 @end
 
 void __raiseExc1() {
- [objc_lookUpClass("NSString") retain]; // expected-warning {{ "bad receiver type 'int'" }} \
+ [objc_lookUpClass("NSString") retain]; // expected-warning {{receiver type 'int' is not 'id'}} \
     expected-warning {{method '-retain' not found}}
 }
 
@@ -14,6 +14,6 @@
 void func() {
   CFStringRef obj;
 
-  [obj self]; // expected-warning {{bad receiver type 'CFStringRef' (aka 'struct __CFString const *')}} \\
+  [obj self]; // expected-warning {{receiver type 'CFStringRef' (aka 'struct __CFString const *') is not 'id'}} \\
                  expected-warning {{method '-self' not found}}
 }

Modified: cfe/trunk/test/SemaObjC/message.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/message.m?rev=66635&r1=66634&r2=66635&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/message.m (original)
+++ cfe/trunk/test/SemaObjC/message.m Tue Mar 10 22:47:47 2009
@@ -80,7 +80,7 @@
 struct S { int X; } S;
 
 int test5(int X) {
-  int a = [X somemsg];  // expected-warning {{bad receiver type 'int'}} \
+  int a = [X somemsg];  // expected-warning {{receiver type 'int' is not 'id'}} \
                            expected-warning {{method '-somemsg' not found}} \
                            expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}}
   int b = [S somemsg];  // expected-error {{bad receiver type 'struct S'}}

Modified: cfe/trunk/test/SemaObjC/super.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super.m?rev=66635&r1=66634&r2=66635&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/super.m (original)
+++ cfe/trunk/test/SemaObjC/super.m Tue Mar 10 22:47:47 2009
@@ -32,7 +32,7 @@
   [super m];
 }
 void f0(int super) {
-  [super m]; // expected-warning{{bad receiver type 'int'}} \
+  [super m]; // expected-warning{{receiver type 'int' is not 'id'}} \
                 expected-warning {{method '-m' not found (return type defaults to 'id')}}
 }
 void f1(int puper) {





More information about the cfe-commits mailing list