summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-05-15 15:27:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-05-15 15:27:35 +0000
commit14040142a3b3c1029092bc1f7c51e347c3fa8f89 (patch)
tree25a8f3ce2536abffc903eb3be145b2a5e4fa9ec5
parent92b522db4e3d79e2fab5fd4ce1574afef201ae58 (diff)
downloadclang-14040142a3b3c1029092bc1f7c51e347c3fa8f89.tar.gz
clang-14040142a3b3c1029092bc1f7c51e347c3fa8f89.tar.bz2
clang-14040142a3b3c1029092bc1f7c51e347c3fa8f89.tar.xz
improve of note message and minor refactoring of my last
patch (r181847). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181896 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--lib/Sema/SemaExprObjC.cpp8
-rw-r--r--test/Analysis/inlining/DynDispatchBifurcate.m2
-rw-r--r--test/Analysis/rdar-6540084.m4
-rw-r--r--test/Modules/objc-categories.m2
-rw-r--r--test/PCH/chain-categories2.m2
-rw-r--r--test/SemaObjC/call-super-2.m2
-rw-r--r--test/SemaObjC/compare-qualified-id.m2
-rw-r--r--test/SemaObjC/conditional-expr.m2
-rw-r--r--test/SemaObjC/error-outof-scope-property-use.m2
-rw-r--r--test/SemaObjC/instancetype.m2
-rw-r--r--test/SemaObjC/message.m2
-rw-r--r--test/SemaObjC/method-not-defined.m2
-rw-r--r--test/SemaObjC/missing-atend-metadata.m2
-rw-r--r--test/SemaObjC/property-5.m2
-rw-r--r--test/SemaObjC/protocol-id-test-1.m2
-rw-r--r--test/SemaObjCXX/instancetype.mm2
17 files changed, 20 insertions, 22 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index bac681e871..55f237736c 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -500,7 +500,7 @@ def note_while_in_implementation : Note<
def note_class_declared : Note<
"class is declared here">;
def note_receiver_class_declared : Note<
- "receiver is object of the class that is declared here">;
+ "receiver is instance of class declared here">;
def note_receiver_is_id : Note<
"receiver is treated with 'id' type for purpose of method lookup">;
def note_suppressed_class_declare : Note<
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 7c701ea040..23116d84ad 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -1227,11 +1227,9 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
SelectorLocs.back());
// Find the class to which we are sending this message.
if (ReceiverType->isObjCObjectPointerType()) {
- QualType ClassType =
- ReceiverType->getAs<ObjCObjectPointerType>()->getPointeeType();
- if (const ObjCObjectType *ClassTPtr = ClassType->getAs<ObjCObjectType>())
- if (ObjCInterfaceDecl *Class = ClassTPtr->getInterface())
- Diag(Class->getLocation(), diag::note_receiver_class_declared);
+ if (ObjCInterfaceDecl *Class =
+ ReceiverType->getAs<ObjCObjectPointerType>()->getInterfaceDecl())
+ Diag(Class->getLocation(), diag::note_receiver_class_declared);
}
}
diff --git a/test/Analysis/inlining/DynDispatchBifurcate.m b/test/Analysis/inlining/DynDispatchBifurcate.m
index d8af213a06..0ce079654e 100644
--- a/test/Analysis/inlining/DynDispatchBifurcate.m
+++ b/test/Analysis/inlining/DynDispatchBifurcate.m
@@ -181,7 +181,7 @@ int testPropertySynthesized(PublicClass *p) {
}
// Test definition not available edge case.
-@interface DefNotAvailClass : NSObject // expected-note {{receiver is object of the class that is declared here}}
+@interface DefNotAvailClass : NSObject // expected-note {{receiver is instance of class declared here}}
@end
id testDefNotAvailableInlined(DefNotAvailClass *C) {
return [C mem]; // expected-warning {{instance method '-mem' not found}}
diff --git a/test/Analysis/rdar-6540084.m b/test/Analysis/rdar-6540084.m
index d93450b5c5..e928710b38 100644
--- a/test/Analysis/rdar-6540084.m
+++ b/test/Analysis/rdar-6540084.m
@@ -9,13 +9,13 @@ typedef struct _NSZone NSZone;
@protocol NSObject - (BOOL)isEqual:(id)object; @end
@interface NSObject <NSObject> {} @end
extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
-@class NSArray; // expected-note {{receiver is object of the class that is declared here}}
+@class NSArray; // expected-note {{receiver is instance of class declared here}}
@class NSMutableArray, NSIndexSet, NSView, NSPredicate, NSString, NSViewAnimation, NSTimer; // expected-note{{forward declaration of class here}}
@interface FooBazController : NSObject {}
@end
typedef struct {} TazVersion;
@class TazNode;
-@interface TazGuttenberg : NSObject {} typedef NSUInteger BugsBunnyType; @end // expected-note {{receiver is object of the class that is declared here}}
+@interface TazGuttenberg : NSObject {} typedef NSUInteger BugsBunnyType; @end // expected-note {{receiver is instance of class declared here}}
@interface FooBaz : NSObject {}
@property (nonatomic) BugsBunnyType matchType;
@property (nonatomic, retain) NSArray *papyrus; @end
diff --git a/test/Modules/objc-categories.m b/test/Modules/objc-categories.m
index 07d1760980..f08b13a78a 100644
--- a/test/Modules/objc-categories.m
+++ b/test/Modules/objc-categories.m
@@ -10,7 +10,7 @@
// expected-note@Inputs/category_left.h:14 {{previous definition}}
// expected-warning@Inputs/category_right.h:11 {{duplicate definition of category}}
-// expected-note@Inputs/category_top.h:1 {{receiver is object of the class that is declared here}}
+// expected-note@Inputs/category_top.h:1 {{receiver is instance of class declared here}}
@interface Foo(Source)
-(void)source;
diff --git a/test/PCH/chain-categories2.m b/test/PCH/chain-categories2.m
index 8cb06a857c..50eea2a560 100644
--- a/test/PCH/chain-categories2.m
+++ b/test/PCH/chain-categories2.m
@@ -45,7 +45,7 @@
#else
//===----------------------------------------------------------------------===//
-// expected-note@30 {{receiver is object of the class that is declared here}}
+// expected-note@30 {{receiver is instance of class declared here}}
void f(I* i) {
[i meth]; // expected-warning {{not found}}
}
diff --git a/test/SemaObjC/call-super-2.m b/test/SemaObjC/call-super-2.m
index 18a5f09407..25cfbdd087 100644
--- a/test/SemaObjC/call-super-2.m
+++ b/test/SemaObjC/call-super-2.m
@@ -14,7 +14,7 @@ id objc_getClass(const char *s);
- (int) instance_func0;
@end
-@interface Derived: Object // expected-note {{receiver is object of the class that is declared here}}
+@interface Derived: Object // expected-note {{receiver is instance of class declared here}}
+ (int) class_func1;
+ (int) class_func2;
+ (int) class_func3;
diff --git a/test/SemaObjC/compare-qualified-id.m b/test/SemaObjC/compare-qualified-id.m
index 0b7e106b35..02fa86ec8d 100644
--- a/test/SemaObjC/compare-qualified-id.m
+++ b/test/SemaObjC/compare-qualified-id.m
@@ -12,7 +12,7 @@ typedef struct _NSZone NSZone;
typedef struct {} NSFastEnumerationState;
@protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; @end
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; @end
-@interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; @end // expected-note {{receiver is object of the class that is declared here}}
+@interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; @end // expected-note {{receiver is instance of class declared here}}
extern NSString * const NSTaskDidTerminateNotification;
@interface XCPropertyExpansionContext : NSObject <NSCopying> { // expected-note {{required for direct or indirect protocol 'NSCopying'}}
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index 083453810c..049a095ce3 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -34,7 +34,7 @@
// No @interface declaration for DTFilterOutputStream3
@implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}} \
- // expected-note {{receiver is object of the class that is declared here}}
+ // expected-note {{receiver is instance of class declared here}}
- (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{method '-nextOutputStream' not found (return type defaults to 'id')}}
self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream3 *' from incompatible type 'id<DTOutputStreams>'}}
diff --git a/test/SemaObjC/error-outof-scope-property-use.m b/test/SemaObjC/error-outof-scope-property-use.m
index 023687bbf4..8ab9f55745 100644
--- a/test/SemaObjC/error-outof-scope-property-use.m
+++ b/test/SemaObjC/error-outof-scope-property-use.m
@@ -2,7 +2,7 @@
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s
// rdar://13178483
-@class NSMutableDictionary; // expected-note {{receiver is object of the class that is declared here}}
+@class NSMutableDictionary; // expected-note {{receiver is instance of class declared here}}
@interface LaunchdJobs
diff --git a/test/SemaObjC/instancetype.m b/test/SemaObjC/instancetype.m
index 2374890271..7811d3eba5 100644
--- a/test/SemaObjC/instancetype.m
+++ b/test/SemaObjC/instancetype.m
@@ -25,7 +25,7 @@
- (instancetype)otherMethodInProto2; // expected-note{{overridden method returns an instance of its class type}}
@end
-@interface Subclass1 : Root // expected-note 4 {{receiver is object of the class that is declared here}}
+@interface Subclass1 : Root // expected-note 4 {{receiver is instance of class declared here}}
- (instancetype)initSubclass1;
- (void)methodOnSubclass1;
+ (instancetype)allocSubclass1;
diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m
index fc75cdbf6e..2c4d8066f6 100644
--- a/test/SemaObjC/message.m
+++ b/test/SemaObjC/message.m
@@ -107,7 +107,7 @@ void foo5(id p) {
// expected-warning {{instance method '-bar' not found}}
}
-@interface I1 // expected-note {{receiver is object of the class that is declared here}}
+@interface I1 // expected-note {{receiver is instance of class declared here}}
-(void)unavail_meth __attribute__((unavailable)); // expected-note {{marked unavailable here}}
@end
diff --git a/test/SemaObjC/method-not-defined.m b/test/SemaObjC/method-not-defined.m
index 8f43c5daa7..792469b719 100644
--- a/test/SemaObjC/method-not-defined.m
+++ b/test/SemaObjC/method-not-defined.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-@interface Foo // expected-note {{receiver is object of the class that is declared here}}
+@interface Foo // expected-note {{receiver is instance of class declared here}}
@end
void test() {
diff --git a/test/SemaObjC/missing-atend-metadata.m b/test/SemaObjC/missing-atend-metadata.m
index 9d0024ac65..f235ab94d8 100644
--- a/test/SemaObjC/missing-atend-metadata.m
+++ b/test/SemaObjC/missing-atend-metadata.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s
-@interface I0 // expected-note {{receiver is object of the class that is declared here}}
+@interface I0 // expected-note {{receiver is instance of class declared here}}
@end
@implementation I0 // expected-note {{implementation started here}}
diff --git a/test/SemaObjC/property-5.m b/test/SemaObjC/property-5.m
index 782f77cfea..cf4f87392b 100644
--- a/test/SemaObjC/property-5.m
+++ b/test/SemaObjC/property-5.m
@@ -8,7 +8,7 @@
@interface MutableNSData : NSData @end
-@interface Base : NSData <P1> // expected-note {{receiver is object of the class that is declared here}}
+@interface Base : NSData <P1> // expected-note {{receiver is instance of class declared here}}
@property(readonly) id ref;
@property(readonly) Base *p_base;
@property(readonly) NSData *nsdata;
diff --git a/test/SemaObjC/protocol-id-test-1.m b/test/SemaObjC/protocol-id-test-1.m
index 013f291ad9..36e23ed9f2 100644
--- a/test/SemaObjC/protocol-id-test-1.m
+++ b/test/SemaObjC/protocol-id-test-1.m
@@ -7,7 +7,7 @@
@protocol P
@end
-@interface INTF<P> // expected-note {{receiver is object of the class that is declared here}}
+@interface INTF<P> // expected-note {{receiver is instance of class declared here}}
- (void)IMeth;
@end
diff --git a/test/SemaObjCXX/instancetype.mm b/test/SemaObjCXX/instancetype.mm
index 87663b9716..89ff2b4b03 100644
--- a/test/SemaObjCXX/instancetype.mm
+++ b/test/SemaObjCXX/instancetype.mm
@@ -25,7 +25,7 @@
- (instancetype)otherMethodInProto2; // expected-note{{overridden method returns an instance of its class type}}
@end
-@interface Subclass1 : Root // expected-note 4 {{receiver is object of the class that is declared here}}
+@interface Subclass1 : Root // expected-note 4 {{receiver is instance of class declared here}}
- (instancetype)initSubclass1;
- (void)methodOnSubclass1;
+ (instancetype)allocSubclass1;