[llvm-branch-commits] [cfe-branch] r71299 - in /cfe/branches/Apple/Dib: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExprObjC.cpp test/Analysis/rdar-6540084.m test/SemaObjC/forward-class-receiver.m

Mike Stump mrs at apple.com
Fri May 8 16:58:45 PDT 2009


Author: mrs
Date: Fri May  8 18:58:44 2009
New Revision: 71299

URL: http://llvm.org/viewvc/llvm-project?rev=71299&view=rev
Log:
Merge in 71296:

We want to diagnose sending message to a forward class
and we also want to tell which message is actually 
being sent.

Modified:
    cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/branches/Apple/Dib/lib/Sema/SemaExprObjC.cpp
    cfe/branches/Apple/Dib/test/Analysis/rdar-6540084.m
    cfe/branches/Apple/Dib/test/SemaObjC/forward-class-receiver.m

Modified: cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td?rev=71299&r1=71298&r2=71299&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/branches/Apple/Dib/include/clang/Basic/DiagnosticSemaKinds.td Fri May  8 18:58:44 2009
@@ -1692,6 +1692,7 @@
 def ext_invalid_sign_spec : Extension<"'%0' cannot be signed or unsigned">;
 def warn_receiver_forward_class : Warning<
     "receiver %0 is a forward class and corresponding @interface may not exist">;
+def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
 def warn_missing_declspec : Warning<
   "declaration specifier missing, defaulting to 'int'">;
 def warn_missing_type_specifier : Warning<

Modified: cfe/branches/Apple/Dib/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Sema/SemaExprObjC.cpp?rev=71299&r1=71298&r2=71299&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Sema/SemaExprObjC.cpp Fri May  8 18:58:44 2009
@@ -424,10 +424,11 @@
   QualType returnType;
   if (ClassDecl->isForwardDecl()) {
     // A forward class used in messaging is tread as a 'Class'
+    Diag(lbrac, diag::warn_receiver_forward_class) << ClassDecl->getDeclName();
     Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(lbrac,rbrac));
     if (Method)
-      Diag(lbrac, diag::warn_receiver_forward_class) 
-        << ClassDecl->getDeclName();
+      Diag(Method->getLocation(), diag::note_method_sent_forward_class) 
+        << Method->getDeclName();
   }
   if (!Method)
     Method = ClassDecl->lookupClassMethod(Context, Sel);

Modified: cfe/branches/Apple/Dib/test/Analysis/rdar-6540084.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Analysis/rdar-6540084.m?rev=71299&r1=71298&r2=71299&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/Analysis/rdar-6540084.m (original)
+++ cfe/branches/Apple/Dib/test/Analysis/rdar-6540084.m Fri May  8 18:58:44 2009
@@ -22,7 +22,7 @@
 @implementation FooBazController
 - (NSArray *)excitingStuff:(FooBaz *)options {
   BugsBunnyType matchType = options.matchType;
-  NSPredicate *isSearchablePredicate = [NSPredicate predicateWithFormat:@"isSearchable == YES"]; // expected-warning{{return type defaults to 'id'}}
+  NSPredicate *isSearchablePredicate = [NSPredicate predicateWithFormat:@"isSearchable == YES"]; // expected-warning{{receiver 'NSPredicate' is a forward class and corresponding}} // expected-warning{{return type defaults to 'id'}}
   for (TazGuttenberg *Guttenberg in options.papyrus) {
     NSArray *GuttenbergNodes = [Guttenberg nodes]; // expected-warning{{return type defaults to 'id'}}
     NSArray *searchableNodes = [GuttenbergNodes filteredArrayUsingPredicate:isSearchablePredicate]; // expected-warning{{return type defaults to 'id'}}

Modified: cfe/branches/Apple/Dib/test/SemaObjC/forward-class-receiver.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/SemaObjC/forward-class-receiver.m?rev=71299&r1=71298&r2=71299&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/test/SemaObjC/forward-class-receiver.m (original)
+++ cfe/branches/Apple/Dib/test/SemaObjC/forward-class-receiver.m Fri May  8 18:58:44 2009
@@ -1,7 +1,7 @@
 // RUN: clang-cc  -fsyntax-only -verify %s
 
 @interface I
-+ new;
++ new; // expected-note {{method 'new' is used for the forward class}}
 @end
 Class isa;
 





More information about the llvm-branch-commits mailing list