Migrate a few more modules tests over to -emit-module-from-map.

llvm-svn: 144779
This commit is contained in:
Douglas Gregor 2011-11-16 05:16:30 +00:00
parent 0e9843b328
commit 84febf4a4d
6 changed files with 62 additions and 68 deletions

View File

@ -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);

View File

@ -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" }

View File

@ -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;

View File

@ -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);
};

View File

@ -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

View File

@ -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