summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC/class-method-self.m
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-04-14 15:11:46 +0000
committerSteve Naroff <snaroff@apple.com>2009-04-14 15:11:46 +0000
commit06f440dd7b00ef8970242bcc9de79d223c35075e (patch)
tree97f61293d2b40b95ec5f66e60d5abd8c811e2545 /clang/test/SemaObjC/class-method-self.m
parent389325715b3b63f0a6080489a48111960b172d2b (diff)
downloadbcm5719-llvm-06f440dd7b00ef8970242bcc9de79d223c35075e.tar.gz
bcm5719-llvm-06f440dd7b00ef8970242bcc9de79d223c35075e.zip
ASTContext::mergeTypes(): Loosen up the type checking for 'Class' (treating it like 'id').
This fixes <rdar://problem/6782722> XCDataTipsManager.m registers, observes notifications in class methods. The radar above is the result of clang typing 'self' in a class method as 'Class', which results in some spurious warnings (GCC types 'self' in a class method as 'id'). I considered changing the type of 'self' to 'id' (to conform to GCC), however this resulted in *many* test cases breaking. In addition, I really prefer a more strongly typed 'self'. All in all, this is the least obtrusive fix I could find for removing the spurious warnings (though we do loose some valid warnings). llvm-svn: 69041
Diffstat (limited to 'clang/test/SemaObjC/class-method-self.m')
-rw-r--r--clang/test/SemaObjC/class-method-self.m26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/class-method-self.m b/clang/test/SemaObjC/class-method-self.m
new file mode 100644
index 00000000000..d36bc8cbc91
--- /dev/null
+++ b/clang/test/SemaObjC/class-method-self.m
@@ -0,0 +1,26 @@
+// RUN: clang-cc -verify %s
+
+typedef struct objc_class *Class;
+@interface XX
+
+- (void)addObserver:(XX*)o;
+
+@end
+
+@interface YY
+
++ (void)classMethod;
+
+@end
+
+@implementation YY
+
+static XX *obj;
+
++ (void)classMethod {
+ [obj addObserver:self];
+ Class whatever;
+ [obj addObserver:whatever]; // GCC warns about this.
+}
+@end
+
OpenPOWER on IntegriCloud