summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/arc-system-header.m
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/SemaObjC/arc-system-header.m
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/SemaObjC/arc-system-header.m')
-rw-r--r--clang/test/SemaObjC/arc-system-header.m50
1 files changed, 50 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/arc-system-header.m b/clang/test/SemaObjC/arc-system-header.m
new file mode 100644
index 0000000..1a7c39d
--- /dev/null
+++ b/clang/test/SemaObjC/arc-system-header.m
@@ -0,0 +1,50 @@
+// silly workaround expected-note {{marked unavailable here}}
+// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -DNO_USE
+// RUN: %clang_cc1 -fobjc-arc -isystem %S/Inputs %s -verify
+
+// another silly workaround expected-note {{marked unavailable here}}
+#include <arc-system-header.h>
+
+#ifndef NO_USE
+void test(id op, void *cp) {
+ cp = test0(op); // expected-error {{'test0' is unavailable: converts between Objective-C and C pointers in -fobjc-arc}}
+ cp = *test1(&op); // expected-error {{'test1' is unavailable: converts between Objective-C and C pointers in -fobjc-arc}}
+}
+
+// workaround expected-note {{marked unavailable here}}
+void test3(struct Test3 *p) {
+ p->field = 0; // expected-error {{'field' is unavailable: this system declaration uses an unsupported type}}
+}
+
+// workaround expected-note {{marked unavailable here}}
+void test4(Test4 *p) {
+ p->field1 = 0; // expected-error {{'field1' is unavailable: this system declaration uses an unsupported type}}
+ p->field2 = 0;
+}
+
+// workaround expected-note {{marked unavailable here}}
+void test5(struct Test5 *p) {
+ p->field = 0; // expected-error {{'field' is unavailable: this system field has retaining ownership}}
+}
+
+id test6() {
+ // This is actually okay to use if declared in a system header.
+ id x;
+ x = (id) kMagicConstant;
+ x = (id) (x ? kMagicConstant : kMagicConstant);
+ x = (id) (x ? kMagicConstant : (void*) 0);
+
+ extern void test6_helper();
+ x = (id) (test6_helper(), kMagicConstant);
+}
+
+// workaround expected-note 4 {{marked unavailable here}}
+void test7(Test7 *p) {
+ *p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
+ p.prop = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
+ *[p prop] = 0; // expected-error {{'prop' is unavailable: this system declaration uses an unsupported type}}
+ [p setProp: 0]; // expected-error {{'setProp:' is unavailable: this system declaration uses an unsupported type}}
+}
+#endif
+
+// test8 in header