aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Modules/Inputs/def.h9
-rw-r--r--test/Modules/decldef.m28
-rw-r--r--test/Modules/decldef.mm19
3 files changed, 55 insertions, 1 deletions
diff --git a/test/Modules/Inputs/def.h b/test/Modules/Inputs/def.h
index 6d06b08125..eb7eb7e59d 100644
--- a/test/Modules/Inputs/def.h
+++ b/test/Modules/Inputs/def.h
@@ -8,4 +8,13 @@
}
@end
+@interface Def
+- defMethod;
+@end
+#ifdef __cplusplus
+class Def2 {
+public:
+ void func();
+};
+#endif
diff --git a/test/Modules/decldef.m b/test/Modules/decldef.m
new file mode 100644
index 0000000000..7fb8a61386
--- /dev/null
+++ b/test/Modules/decldef.m
@@ -0,0 +1,28 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
+
+
+// In other file: expected-note {{previous definition is here}}
+
+@class Def;
+Def *def;
+
+@import decldef;
+A *a1; // expected-error{{unknown type name 'A'}}
+B *b1; // expected-error{{must use 'struct' tag to refer to type 'B'}}
+@import decldef.Decl;
+
+A *a2;
+struct B *b;
+
+void testA(A *a) {
+ a->ivar = 17; // expected-error{{definition of 'A' must be imported from module 'decldef.Def' before it is required}}
+}
+
+void testB() {
+ B b; // Note: redundant error silenced
+}
+
+void testDef() {
+ [def defMethod];
+}
diff --git a/test/Modules/decldef.mm b/test/Modules/decldef.mm
index 97ce72dd35..732c2a27e2 100644
--- a/test/Modules/decldef.mm
+++ b/test/Modules/decldef.mm
@@ -1,9 +1,18 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -fmodules -I %S/Inputs -fmodules-cache-path=%t %s -verify
+// RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
// In other file: expected-note {{previous definition is here}}
+@class Def;
+Def *def;
+class Def2;
+Def2 *def2;
+
+@interface Unrelated
+- defMethod;
+@end
+
@import decldef;
A *a1; // expected-error{{unknown type name 'A'}}
B *b1; // expected-error{{unknown type name 'B'}}
@@ -19,3 +28,11 @@ void testA(A *a) {
void testB() {
B b; // Note: redundant error silenced
}
+
+void testDef() {
+ [def defMethod];
+}
+
+void testDef2() {
+ def2->func();
+}