Implement support for wildcard exports in modules, allowing a module
to re-export anything that it imports. This opt-in feature makes a
module behave more like a header, because it can be used to re-export
the transitive closure of a (sub)module's dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145811 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 7d8d11f..f25a36e 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -9,8 +9,7 @@
}
module diamond_bottom {
header "diamond_bottom.h"
- export diamond_left
- export diamond_right
+ export *
}
module irgen { header "irgen.h" }
module lookup_left_objc { header "lookup_left.h" }
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/A_one.h b/test/Modules/Inputs/wildcard-submodule-exports/A_one.h
new file mode 100644
index 0000000..4a2c239
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/A_one.h
@@ -0,0 +1 @@
+int *A1;
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/A_two.h b/test/Modules/Inputs/wildcard-submodule-exports/A_two.h
new file mode 100644
index 0000000..1b08599
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/A_two.h
@@ -0,0 +1 @@
+unsigned int *A2;
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/B_one.h b/test/Modules/Inputs/wildcard-submodule-exports/B_one.h
new file mode 100644
index 0000000..0f44a56
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/B_one.h
@@ -0,0 +1 @@
+short *B1;
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/B_two.h b/test/Modules/Inputs/wildcard-submodule-exports/B_two.h
new file mode 100644
index 0000000..0e51242
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/B_two.h
@@ -0,0 +1 @@
+unsigned short *B2;
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_one.h b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
new file mode 100644
index 0000000..cbdc2be
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/C_one.h
@@ -0,0 +1,4 @@
+__import_module__ A.One;
+__import_module__ B.One;
+
+long *C1;
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/C_two.h b/test/Modules/Inputs/wildcard-submodule-exports/C_two.h
new file mode 100644
index 0000000..6a66ac7
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/C_two.h
@@ -0,0 +1,4 @@
+__import_module__ A.Two;
+__import_module__ B.Two;
+
+unsigned long *C2;
diff --git a/test/Modules/Inputs/wildcard-submodule-exports/module.map b/test/Modules/Inputs/wildcard-submodule-exports/module.map
new file mode 100644
index 0000000..64b0d89
--- /dev/null
+++ b/test/Modules/Inputs/wildcard-submodule-exports/module.map
@@ -0,0 +1,20 @@
+module A {
+ module One { header "A_one.h" }
+ module Two { header "A_two.h" }
+}
+
+module B {
+ module One { header "B_one.h" }
+ module Two { header "B_two.h" }
+}
+
+module C {
+ module One {
+ header "C_one.h"
+ export A.*
+ }
+ module Two {
+ header "C_two.h"
+ export *
+ }
+}
diff --git a/test/Modules/wildcard-submodule-exports.cpp b/test/Modules/wildcard-submodule-exports.cpp
new file mode 100644
index 0000000..b892acb
--- /dev/null
+++ b/test/Modules/wildcard-submodule-exports.cpp
@@ -0,0 +1,25 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-cache-path %t -fauto-module-import -I %S/Inputs/wildcard-submodule-exports %s -verify
+
+__import_module__ C.One;
+
+void test_C_One() {
+ int *A1_ptr = A1;
+ long *C1_ptr = C1;
+ (void)B1; // expected-error{{use of undeclared identifier 'B1'}}
+}
+
+__import_module__ C.Two;
+
+void test_C_Two() {
+ unsigned int *A2_ptr = A2;
+ unsigned short *B2_ptr = B2;
+ unsigned long *C2_ptr = C2;
+}
+
+__import_module__ B.One;
+
+void test_B_One() {
+ short *B1_ptr = B1;
+}
+