diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-19 18:06:43 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-19 18:06:43 +0000 |
commit | 1d2a4311da8b332fd309992c1a426420722e4ac5 (patch) | |
tree | 6f372393a3803a9b4b11fc163346bc4d50db75b3 | |
parent | 105716ecab261f4356f111a6f25927a9a7d9c93b (diff) |
Merge headers into test/PCH/chain-cxx.cpp for convenience.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116836 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/PCH/Inputs/chain-cxx1.h | 19 | ||||
-rw-r--r-- | test/PCH/Inputs/chain-cxx2.h | 32 | ||||
-rw-r--r-- | test/PCH/chain-cxx.cpp | 73 |
3 files changed, 70 insertions, 54 deletions
diff --git a/test/PCH/Inputs/chain-cxx1.h b/test/PCH/Inputs/chain-cxx1.h deleted file mode 100644 index 7ea3ffb61c..0000000000 --- a/test/PCH/Inputs/chain-cxx1.h +++ /dev/null @@ -1,19 +0,0 @@ -// Primary header for C++ chained PCH test - -void f(); - -// Name not appearing in dependent -void pf(); - -namespace ns { - void g(); - - void pg(); -} - -template <typename T> -struct S { typedef int G; }; - -// Partially specialize -template <typename T> -struct S<T *> { typedef int H; }; diff --git a/test/PCH/Inputs/chain-cxx2.h b/test/PCH/Inputs/chain-cxx2.h deleted file mode 100644 index adc10fd836..0000000000 --- a/test/PCH/Inputs/chain-cxx2.h +++ /dev/null @@ -1,32 +0,0 @@ -// Dependent header for C++ chained PCH test - -// Overload function from primary -void f(int); - -// Add function with different name -void f2(); - -// Reopen namespace -namespace ns { - // Overload function from primary - void g(int); - - // Add different name - void g2(); -} - -// Specialize template from primary -template <> -struct S<int> { typedef int I; }; - -// Partially specialize -template <typename T> -struct S<T &> { typedef int J; }; - -// Specialize previous partial specialization -template <> -struct S<int *> { typedef int K; }; - -// Specialize the partial specialization from this file -template <> -struct S<int &> { typedef int L; }; diff --git a/test/PCH/chain-cxx.cpp b/test/PCH/chain-cxx.cpp index 3e46214c70..b2d0523410 100644 --- a/test/PCH/chain-cxx.cpp +++ b/test/PCH/chain-cxx.cpp @@ -1,13 +1,77 @@ // Test C++ chained PCH functionality // Without PCH -// RUN: %clang_cc1 -fsyntax-only -verify -include %S/Inputs/chain-cxx1.h -include %S/Inputs/chain-cxx2.h %s +// RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s // With PCH -// RUN: %clang_cc1 -x c++ -emit-pch -o %t1 %S/Inputs/chain-cxx1.h -// RUN: %clang_cc1 -x c++ -emit-pch -o %t2 %S/Inputs/chain-cxx2.h -include-pch %t1 -chained-pch +// RUN: %clang_cc1 -x c++-header -emit-pch -o %t1 %s +// RUN: %clang_cc1 -x c++-header -emit-pch -o %t2 %s -include-pch %t1 -chained-pch // RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s +#ifndef HEADER1 +#define HEADER1 +//===----------------------------------------------------------------------===// +// Primary header for C++ chained PCH test + +void f(); + +// Name not appearing in dependent +void pf(); + +namespace ns { + void g(); + + void pg(); +} + +template <typename T> +struct S { typedef int G; }; + +// Partially specialize +template <typename T> +struct S<T *> { typedef int H; }; + +//===----------------------------------------------------------------------===// +#elif not defined(HEADER2) +#define HEADER2 +//===----------------------------------------------------------------------===// +// Dependent header for C++ chained PCH test + +// Overload function from primary +void f(int); + +// Add function with different name +void f2(); + +// Reopen namespace +namespace ns { + // Overload function from primary + void g(int); + + // Add different name + void g2(); +} + +// Specialize template from primary +template <> +struct S<int> { typedef int I; }; + +// Partially specialize +template <typename T> +struct S<T &> { typedef int J; }; + +// Specialize previous partial specialization +template <> +struct S<int *> { typedef int K; }; + +// Specialize the partial specialization from this file +template <> +struct S<int &> { typedef int L; }; + +//===----------------------------------------------------------------------===// +#else +//===----------------------------------------------------------------------===// + void test() { f(); f(1); @@ -26,3 +90,6 @@ void test() { typedef S<int *>::K T5; typedef S<int &>::L T6; } + +//===----------------------------------------------------------------------===// +#endif |