| 1 |
// Test this without pch. |
| 2 |
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -DSOURCE -emit-llvm -o - %s |
| 3 |
|
| 4 |
// Test with pch. |
| 5 |
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -o %t %s |
| 6 |
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -emit-llvm -o - %s |
| 7 |
|
| 8 |
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -emit-pch -fpch-instantiate-templates -o %t %s |
| 9 |
// RUN: %clang_cc1 -x c++ -std=c++11 -DHEADER -include-pch %t -emit-llvm -o - %s |
| 10 |
|
| 11 |
#ifdef HEADER |
| 12 |
int n; |
| 13 |
struct S { |
| 14 |
int *p = &m; |
| 15 |
int &m = n; |
| 16 |
S *that = this; |
| 17 |
}; |
| 18 |
template<typename T> struct X { T t {0}; }; |
| 19 |
|
| 20 |
struct v_t { }; |
| 21 |
|
| 22 |
struct m_t |
| 23 |
{ |
| 24 |
struct { v_t v; }; |
| 25 |
m_t() { } |
| 26 |
}; |
| 27 |
|
| 28 |
#endif |
| 29 |
|
| 30 |
#ifdef SOURCE |
| 31 |
S s; |
| 32 |
|
| 33 |
struct E { explicit E(int); }; |
| 34 |
X<E> x; |
| 35 |
|
| 36 |
m_t *test() { |
| 37 |
return new m_t; |
| 38 |
} |
| 39 |
|
| 40 |
#elif HEADER |
| 41 |
#undef HEADER |
| 42 |
#define SOURCE |
| 43 |
#endif |