summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC/protocol-qualified-class-unsupported.m
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-04-07 15:07:57 +0000
committerSteve Naroff <snaroff@apple.com>2009-04-07 15:07:57 +0000
commitebc790d4d80bd6aeed7a29b510071416b6509b74 (patch)
tree4cb8eeaeafd850ef455809009458a591acdf926d /clang/test/SemaObjC/protocol-qualified-class-unsupported.m
parentc4631b2809cf27fd72baf192c1b6eac942cc4f62 (diff)
downloadbcm5719-llvm-ebc790d4d80bd6aeed7a29b510071416b6509b74.tar.gz
bcm5719-llvm-ebc790d4d80bd6aeed7a29b510071416b6509b74.zip
Tweak Sema::ActOnInstanceMessage() to look for a class method when dealing with qualified id's. This change is motivated by our desire to not support the "Class<foo>" idiom. Note that the change makes perfect sense (since all ObjC classes are also id/instances).
This allow us to document a simple migration path...change "Class <foo>" to "id <foo>". This effects: - <rdar://problem/6761939> TASK: File source change radars for "qualified Class" errors - <rdar://problem/6761864> Protocol qualified Class is unsupported llvm-svn: 68517
Diffstat (limited to 'clang/test/SemaObjC/protocol-qualified-class-unsupported.m')
-rw-r--r--clang/test/SemaObjC/protocol-qualified-class-unsupported.m40
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/protocol-qualified-class-unsupported.m b/clang/test/SemaObjC/protocol-qualified-class-unsupported.m
new file mode 100644
index 00000000000..ad1ed5dc941
--- /dev/null
+++ b/clang/test/SemaObjC/protocol-qualified-class-unsupported.m
@@ -0,0 +1,40 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+#include <stddef.h>
+
+typedef struct objc_class *Class;
+typedef struct objc_object {
+ Class isa;
+} *id;
+id objc_getClass(const char *s);
+
+@interface Object
++ self;
+@end
+
+@protocol Func
++ (void) class_func0;
+- (void) instance_func0;
+@end
+
+@interface Derived: Object <Func>
+@end
+
+@interface Derived2: Object <Func>
+@end
+
+static void doSomething(Class <Func> unsupportedObjectType) { // expected-error {{protocol qualified 'Class' is unsupported}}
+ [unsupportedObjectType class_func0];
+}
+
+static void doSomethingElse(id <Func> pleaseConvertToThisType) {
+ [pleaseConvertToThisType class_func0];
+}
+
+int main(int argv, char *argc[]) {
+ doSomething([Derived self]);
+ doSomething([Derived2 self]);
+ doSomethingElse([Derived self]);
+ doSomethingElse([Derived2 self]);
+}
+
OpenPOWER on IntegriCloud