summaryrefslogtreecommitdiffstats
path: root/test/Modules/module-private.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Modules/module-private.cpp')
-rw-r--r--test/Modules/module-private.cpp82
1 files changed, 19 insertions, 63 deletions
diff --git a/test/Modules/module-private.cpp b/test/Modules/module-private.cpp
index 7bd2a20..246dcaf 100644
--- a/test/Modules/module-private.cpp
+++ b/test/Modules/module-private.cpp
@@ -1,54 +1,11 @@
-// 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 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_left -emit-module %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t -fmodule-name=module_private_right -emit-module %S/Inputs/module.map
+// RUN: %clang_cc1 -fmodules -x objective-c++ -fmodule-cache-path %t %s -verify
+// FIXME: When we have a syntax for modules in C++, use that.
-#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;
+@__experimental_modules_import module_private_left;
+@__experimental_modules_import module_private_right;
void test() {
int &ir = f0(1.0); // okay: f0() from 'right' is not visible
@@ -75,28 +32,28 @@ int test_broken() {
// Check for private redeclarations of public entities.
template<typename T>
-class public_class_template; // expected-note{{previous declaration is here}}
+class public_class_template;
template<typename T>
-__module_private__ class public_class_template; // expected-error{{__module_private__ declaration of 'public_class_template' follows public declaration}}
+__module_private__ class public_class_template;
-typedef int public_typedef; // expected-note{{previous declaration is here}}
-typedef __module_private__ int public_typedef; // expected-error{{__module_private__ declaration of 'public_typedef' follows public declaration}}
+typedef int public_typedef;
+typedef __module_private__ int public_typedef;
-extern int public_var; // expected-note{{previous declaration is here}}
-extern __module_private__ int public_var; // expected-error{{__module_private__ declaration of 'public_var' follows public declaration}}
+extern int public_var;
+extern __module_private__ int public_var;
-void public_func(); // expected-note{{previous declaration is here}}
-__module_private__ void public_func(); // expected-error{{__module_private__ declaration of 'public_func' follows public declaration}}
+void public_func();
+__module_private__ void public_func();
template<typename T>
-void public_func_template(); // expected-note{{previous declaration is here}}
+void public_func_template();
template<typename T>
-__module_private__ void public_func_template(); // expected-error{{__module_private__ declaration of 'public_func_template' follows public declaration}}
+__module_private__ void public_func_template();
-struct public_struct; // expected-note{{previous declaration is here}}
-__module_private__ struct public_struct; // expected-error{{__module_private__ declaration of 'public_struct' follows public declaration}}
+struct public_struct;
+__module_private__ struct public_struct;
// Check for attempts to make specializations private
template<> __module_private__ void public_func_template<int>(); // expected-error{{template specialization cannot be declared __module_private__}}
@@ -137,4 +94,3 @@ struct LikeVisibleStruct {
};
int check_struct_size[sizeof(VisibleStruct) == sizeof(LikeVisibleStruct)? 1 : -1];
-#endif
OpenPOWER on IntegriCloud