diff options
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 1 | ||||
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 5 | ||||
-rw-r--r-- | test/Analysis/rdar-6540084.m | 2 | ||||
-rw-r--r-- | test/SemaObjC/forward-class-receiver.m | 2 |
4 files changed, 6 insertions, 4 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index f491a43e3b..577392cbd6 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1692,6 +1692,7 @@ def err_collection_expr_type : Error< 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< diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 3dbc2cf015..de6b69f90f 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -424,10 +424,11 @@ Sema::ExprResult Sema::ActOnClassMessage( 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); diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m index c788543bf3..18ab038f6e 100644 --- a/test/Analysis/rdar-6540084.m +++ b/test/Analysis/rdar-6540084.m @@ -22,7 +22,7 @@ typedef struct {} TazVersion; @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'}} diff --git a/test/SemaObjC/forward-class-receiver.m b/test/SemaObjC/forward-class-receiver.m index 8353f39d38..ebba0fd896 100644 --- a/test/SemaObjC/forward-class-receiver.m +++ b/test/SemaObjC/forward-class-receiver.m @@ -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; |