summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/decl.h2
-rw-r--r--clang/test/Modules/Inputs/def.h7
-rw-r--r--clang/test/Modules/Inputs/module.map5
-rw-r--r--clang/test/Modules/decldef.mm17
4 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/decl.h b/clang/test/Modules/Inputs/decl.h
new file mode 100644
index 00000000000..8dbe11eccc7
--- /dev/null
+++ b/clang/test/Modules/Inputs/decl.h
@@ -0,0 +1,2 @@
+@class A;
+typedef struct B B;
diff --git a/clang/test/Modules/Inputs/def.h b/clang/test/Modules/Inputs/def.h
new file mode 100644
index 00000000000..c9bc36d61da
--- /dev/null
+++ b/clang/test/Modules/Inputs/def.h
@@ -0,0 +1,7 @@
+@interface A
+@end
+
+struct B {
+ int b1;
+};
+
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index f25a36edfbd..6b93a6acef4 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -36,3 +36,8 @@ module category_bottom {
module redeclarations_left { header "redeclarations_left.h" }
module redeclarations_right { header "redeclarations_right.h" }
module load_failure { header "load_failure.h" }
+
+module decldef {
+ explicit module Decl { header "decl.h" }
+ explicit module Def { header "def.h" }
+} \ No newline at end of file
diff --git a/clang/test/Modules/decldef.mm b/clang/test/Modules/decldef.mm
new file mode 100644
index 00000000000..bbdcd9cb8fa
--- /dev/null
+++ b/clang/test/Modules/decldef.mm
@@ -0,0 +1,17 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -I %S/Inputs -fmodule-cache-path %t %s -verify
+
+__import_module__ decldef;
+A *a1; // expected-error{{unknown type name 'A'}}
+B *b1; // expected-error{{unknown type name 'B'}}
+
+__import_module__ decldef.Decl;
+
+// FIXME: No link between @interface (which we can't see) and @class
+// (which we can).
+// A *a2;
+B *b;
+
+void testB() {
+ B b; // FIXME: Should error, because we can't see the definition.
+}
OpenPOWER on IntegriCloud