[cfe-commits] r65779 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.def lib/Sema/SemaExprObjC.cpp test/SemaObjC/bad-receiver-1.m test/SemaObjC/super.m

Steve Naroff snaroff at apple.com
Sun Mar 1 09:14:31 PST 2009


Author: snaroff
Date: Sun Mar  1 11:14:31 2009
New Revision: 65779

URL: http://llvm.org/viewvc/llvm-project?rev=65779&view=rev
Log:
Fix <rdar://problem/6248764> parser rejects: bad receiver type 'CFStringRef'.

Downgrade an error to a warning (for GCC compatibility).

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def
    cfe/trunk/lib/Sema/SemaExprObjC.cpp
    cfe/trunk/test/SemaObjC/bad-receiver-1.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=65779&r1=65778&r2=65779&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.def Sun Mar  1 11:14:31 2009
@@ -946,7 +946,7 @@
      "no super class declared in @interface for %0")
 DIAG(err_invalid_receiver_to_message, ERROR,
      "invalid receiver to message expression")
-DIAG(error_bad_receiver_type, ERROR,
+DIAG(warn_bad_receiver_type, WARNING,
      "bad receiver type %0")
 DIAG(error_objc_throw_expects_object, ERROR,
      "invalid %0 argument (expected an ObjC object type)")

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=65779&r1=65778&r2=65779&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Sun Mar  1 11:14:31 2009
@@ -464,7 +464,7 @@
     if (Method && DiagnoseUseOfDecl(Method, receiverLoc))
       return true;
   } else {
-    Diag(lbrac, diag::error_bad_receiver_type)
+    Diag(lbrac, diag::warn_bad_receiver_type)
       << RExpr->getType() << RExpr->getSourceRange();
     return true;
   }

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=65779&r1=65778&r2=65779&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/bad-receiver-1.m (original)
+++ cfe/trunk/test/SemaObjC/bad-receiver-1.m Sun Mar  1 11:14:31 2009
@@ -5,5 +5,13 @@
 @end
 
 void __raiseExc1() {
- [objc_lookUpClass("NSString") retain]; // expected-error {{ "bad receiver type 'int'" }}
+ [objc_lookUpClass("NSString") retain]; // expected-warning {{ "bad receiver type 'int'" }}
+}
+
+typedef const struct __CFString * CFStringRef;
+
+void func() {
+  CFStringRef obj;
+
+  [obj self]; // expected-warning {{bad receiver type 'CFStringRef' (aka 'struct __CFString const *')}}
 }

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

==============================================================================
--- cfe/trunk/test/SemaObjC/super.m (original)
+++ cfe/trunk/test/SemaObjC/super.m Sun Mar  1 11:14:31 2009
@@ -32,7 +32,7 @@
   [super m];
 }
 void f0(int super) {
-  [super m]; // expected-error{{bad receiver type 'int'}}
+  [super m]; // expected-warning{{bad receiver type 'int'}}
 }
 void f1(int puper) {
   [super m]; // expected-error{{use of undeclared identifier 'super'}}





More information about the cfe-commits mailing list