aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Modules/Inputs/macros.h10
-rw-r--r--test/Modules/Inputs/module.map3
-rw-r--r--test/Modules/Inputs/module_private_left.h26
-rw-r--r--test/Modules/Inputs/module_private_right.h13
-rw-r--r--test/Modules/macros.c21
-rw-r--r--test/Modules/module-private.cpp57
6 files changed, 62 insertions, 68 deletions
diff --git a/test/Modules/Inputs/macros.h b/test/Modules/Inputs/macros.h
new file mode 100644
index 0000000000..4be71aaaa0
--- /dev/null
+++ b/test/Modules/Inputs/macros.h
@@ -0,0 +1,10 @@
+#define MODULE
+#define INTEGER(X) int
+#define FLOAT float
+#define DOUBLE double
+
+#__export_macro__ INTEGER
+#__private_macro__ FLOAT
+#__private_macro__ MODULE
+
+int (INTEGER);
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 67a90ccaad..13546b08fe 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -7,3 +7,6 @@ module lookup_left_objc { umbrella "lookup_left.h" }
module lookup_right_objc { umbrella "lookup_right.h" }
module lookup_left_cxx { umbrella "lookup_left.hpp" }
module lookup_right_cxx { umbrella "lookup_right.hpp" }
+module module_private_left { umbrella "module_private_left.h" }
+module module_private_right { umbrella "module_private_right.h" }
+module macros { umbrella "macros.h" }
diff --git a/test/Modules/Inputs/module_private_left.h b/test/Modules/Inputs/module_private_left.h
new file mode 100644
index 0000000000..617a7abf3d
--- /dev/null
+++ b/test/Modules/Inputs/module_private_left.h
@@ -0,0 +1,26 @@
+__module_private__ struct HiddenStruct;
+
+struct HiddenStruct {
+};
+
+
+int &f0(int);
+
+template<typename T>
+__module_private__ void f1(T*);
+
+template<typename T>
+void f1(T*);
+
+template<typename T>
+__module_private__ class vector;
+
+template<typename T>
+class vector {
+};
+
+vector<float> vec_float;
+
+typedef __module_private__ int Integer;
+typedef int Integer;
+
diff --git a/test/Modules/Inputs/module_private_right.h b/test/Modules/Inputs/module_private_right.h
new file mode 100644
index 0000000000..e7c1bb8221
--- /dev/null
+++ b/test/Modules/Inputs/module_private_right.h
@@ -0,0 +1,13 @@
+__module_private__ double &f0(double);
+double &f0(double);
+
+__module_private__ int hidden_var;
+
+inline void test_f0_in_right() {
+ double &dr = f0(hidden_var);
+}
+
+struct VisibleStruct {
+ __module_private__ int field;
+ __module_private__ virtual void setField(int f);
+};
diff --git a/test/Modules/macros.c b/test/Modules/macros.c
index e371237bb0..3eb0dbb3be 100644
--- a/test/Modules/macros.c
+++ b/test/Modules/macros.c
@@ -1,19 +1,7 @@
-// RUN: %clang_cc1 -emit-module -o %t/macros.pcm -DMODULE %s
-// RUN: %clang_cc1 -verify -fmodule-cache-path %t -fdisable-module-hash %s
-// RUN: %clang_cc1 -E -fmodule-cache-path %t -fdisable-module-hash %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
-
-#if defined(MODULE)
-#define INTEGER(X) int
-#define FLOAT float
-#define DOUBLE double
-
-#__export_macro__ INTEGER
-#__private_macro__ FLOAT
-#__private_macro__ MODULE
-
-int (INTEGER);
-
-#else
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -emit-module-from-map -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map
+// RUN: %clang_cc1 -verify -fmodule-cache-path %t %s
+// RUN: %clang_cc1 -E -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
__import_module__ macros;
@@ -39,4 +27,3 @@ void f() {
// CHECK-PREPROCESSED: int i = INTEGER;
int i = INTEGER; // the value was exported, the macro was not.
}
-#endif
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp
index 7bd2a205c0..500c587010 100644
--- a/test/Modules/module-private.cpp
+++ b/test/Modules/module-private.cpp
@@ -1,54 +1,10 @@
-// RUN: mkdir -p %t
-// RUN: %clang_cc1 -x c++ -emit-module -o %t/left.pcm %s -D MODULE_LEFT
-// RUN: %clang_cc1 -x c++ -emit-module -o %t/right.pcm %s -D MODULE_RIGHT
-// RUN: %clang_cc1 -fmodule-cache-path %t -fdisable-module-hash %s -verify
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-cache-path %t -fmodule-name=module_private_left -x c++ -emit-module-from-map %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t -fmodule-name=module_private_right -x c++ -emit-module-from-map %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodule-cache-path %t %s -verify
-#if defined(MODULE_LEFT)
-
-__module_private__ struct HiddenStruct;
-
-struct HiddenStruct {
-};
-
-
-int &f0(int);
-
-template<typename T>
-__module_private__ void f1(T*);
-
-template<typename T>
-void f1(T*);
-
-template<typename T>
-__module_private__ class vector;
-
-template<typename T>
-class vector {
-};
-
-vector<float> vec_float;
-
-typedef __module_private__ int Integer;
-typedef int Integer;
-
-#elif defined(MODULE_RIGHT)
-__module_private__ double &f0(double);
-double &f0(double);
-
-__module_private__ int hidden_var;
-
-inline void test_f0_in_right() {
- double &dr = f0(hidden_var);
-}
-
-struct VisibleStruct {
- __module_private__ int field;
- __module_private__ virtual void setField(int f);
-};
-
-#else
-__import_module__ left;
-__import_module__ right;
+__import_module__ module_private_left;
+__import_module__ module_private_right;
void test() {
int &ir = f0(1.0); // okay: f0() from 'right' is not visible
@@ -137,4 +93,3 @@ struct LikeVisibleStruct {
};
int check_struct_size[sizeof(VisibleStruct) == sizeof(LikeVisibleStruct)? 1 : -1];
-#endif