summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/chain-openmp-threadprivate.cpp26
-rw-r--r--test/PCH/cxx-namespaces.cpp4
-rw-r--r--test/PCH/cxx-traits.cpp65
-rw-r--r--test/PCH/cxx-traits.h53
-rw-r--r--test/PCH/cxx1y-lambdas.mm2
-rw-r--r--test/PCH/pragma-loop.cpp28
-rw-r--r--test/PCH/pragma-optimize.c6
-rw-r--r--test/PCH/stmt-attrs.cpp48
-rw-r--r--test/PCH/verify_pch.m14
9 files changed, 202 insertions, 44 deletions
diff --git a/test/PCH/chain-openmp-threadprivate.cpp b/test/PCH/chain-openmp-threadprivate.cpp
new file mode 100644
index 0000000000000..5187257b06ed7
--- /dev/null
+++ b/test/PCH/chain-openmp-threadprivate.cpp
@@ -0,0 +1,26 @@
+// no PCH
+// RUN: %clang_cc1 -fopenmp=libiomp5 -emit-llvm -include %s -include %s %s -o - | FileCheck %s
+// with PCH
+// RUN: %clang_cc1 -fopenmp=libiomp5 -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s
+#if !defined(PASS1)
+#define PASS1
+
+extern "C" int* malloc (int size);
+int *a = malloc(20);
+
+#elif !defined(PASS2)
+#define PASS2
+
+#pragma omp threadprivate(a)
+
+#else
+
+// CHECK: call {{.*}} @__kmpc_threadprivate_register(
+
+// CHECK-LABEL: foo
+int foo() {
+ return *a;
+ // CHECK: call {{.*}} @__kmpc_global_thread_num(
+ // CHECK: call {{.*}} @__kmpc_threadprivate_cached(
+}
+#endif
diff --git a/test/PCH/cxx-namespaces.cpp b/test/PCH/cxx-namespaces.cpp
index e0feaab6910a0..d1bf98b4ca170 100644
--- a/test/PCH/cxx-namespaces.cpp
+++ b/test/PCH/cxx-namespaces.cpp
@@ -4,12 +4,12 @@
// Test with pch.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only -ast-dump -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
// Test with modules.
// RUN: %clang_cc1 -fmodules -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
// RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -ast-dump -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
+// RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
// expected-no-diagnostics
diff --git a/test/PCH/cxx-traits.cpp b/test/PCH/cxx-traits.cpp
index ffdfccc6f47f4..fc3e1335dd60c 100644
--- a/test/PCH/cxx-traits.cpp
+++ b/test/PCH/cxx-traits.cpp
@@ -1,15 +1,66 @@
// Test this without pch.
-// RUN: %clang_cc1 -include %S/cxx-traits.h -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fms-extensions -include %S/cxx-traits.h -std=c++11 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %S/cxx-traits.h
-// RUN: %clang_cc1 -std=c++11 -include-pch %t -DPCH -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fms-extensions -x c++-header -std=c++11 -emit-pch -o %t %S/cxx-traits.h
+// RUN: %clang_cc1 -fms-extensions -std=c++11 -include-pch %t -DPCH -fsyntax-only -verify %s
#ifdef PCH
// expected-no-diagnostics
#endif
-bool _Is_pod_comparator = __is_pod<int>::__value;
-bool _Is_empty_check = __is_empty<int>::__value;
+bool _Is_pod_comparator = n::__is_pod<int>::__value;
+bool _Is_empty_check = n::__is_empty<int>::__value;
-bool default_construct_int = is_trivially_constructible<int>::value;
-bool copy_construct_int = is_trivially_constructible<int, const int&>::value;
+bool default_construct_int = n::is_trivially_constructible<int>::value;
+bool copy_construct_int = n::is_trivially_constructible<int, const int&>::value;
+
+// The built-ins should still work too:
+bool _is_abstract_result = __is_abstract(int);
+bool _is_arithmetic_result = __is_arithmetic(int);
+bool _is_array_result = __is_array(int);
+bool _is_base_of_result = __is_base_of(int, int);
+bool _is_class_result = __is_class(int);
+bool _is_complete_type_result = __is_complete_type(int);
+bool _is_compound_result = __is_compound(int);
+bool _is_const_result = __is_const(int);
+bool _is_constructible_result = __is_constructible(int);
+bool _is_convertible_result = __is_convertible(int, int);
+bool _is_convertible_to_result = __is_convertible_to(int, int);
+bool _is_destructible_result = __is_destructible(int);
+bool _is_empty_result = __is_empty(int);
+bool _is_enum_result = __is_enum(int);
+bool _is_floating_point_result = __is_floating_point(int);
+bool _is_final_result = __is_final(int);
+bool _is_function_result = __is_function(int);
+bool _is_fundamental_result = __is_fundamental(int);
+bool _is_integral_result = __is_integral(int);
+bool _is_interface_class_result = __is_interface_class(int);
+bool _is_literal_result = __is_literal(int);
+bool _is_lvalue_expr_result = __is_lvalue_expr(0);
+bool _is_lvalue_reference_result = __is_lvalue_reference(int);
+bool _is_member_function_pointer_result = __is_member_function_pointer(int);
+bool _is_member_object_pointer_result = __is_member_object_pointer(int);
+bool _is_member_pointer_result = __is_member_pointer(int);
+bool _is_nothrow_assignable_result = __is_nothrow_assignable(int, int);
+bool _is_nothrow_constructible_result = __is_nothrow_constructible(int);
+bool _is_nothrow_destructible_result = __is_nothrow_destructible(int);
+bool _is_object_result = __is_object(int);
+bool _is_pod_result = __is_pod(int);
+bool _is_pointer_result = __is_pointer(int);
+bool _is_polymorphic_result = __is_polymorphic(int);
+bool _is_reference_result = __is_reference(int);
+bool _is_rvalue_expr_result = __is_rvalue_expr(0);
+bool _is_rvalue_reference_result = __is_rvalue_reference(int);
+bool _is_same_result = __is_same(int, int);
+bool _is_scalar_result = __is_scalar(int);
+bool _is_sealed_result = __is_sealed(int);
+bool _is_signed_result = __is_signed(int);
+bool _is_standard_layout_result = __is_standard_layout(int);
+bool _is_trivial_result = __is_trivial(int);
+bool _is_trivially_assignable_result = __is_trivially_assignable(int, int);
+bool _is_trivially_constructible_result = __is_trivially_constructible(int);
+bool _is_trivially_copyable_result = __is_trivially_copyable(int);
+bool _is_union_result = __is_union(int);
+bool _is_unsigned_result = __is_unsigned(int);
+bool _is_void_result = __is_void(int);
+bool _is_volatile_result = __is_volatile(int);
diff --git a/test/PCH/cxx-traits.h b/test/PCH/cxx-traits.h
index e6f2feb1d116a..21324768186ee 100644
--- a/test/PCH/cxx-traits.h
+++ b/test/PCH/cxx-traits.h
@@ -1,5 +1,7 @@
// Header for PCH test cxx-traits.cpp
+namespace n {
+
template<typename _Tp>
struct __is_pod { // expected-warning {{keyword '__is_pod' will be made available as an identifier for the remainder of the translation unit}}
enum { __value };
@@ -14,3 +16,54 @@ template<typename T, typename ...Args>
struct is_trivially_constructible {
static const bool value = __is_trivially_constructible(T, Args...);
};
+
+struct __is_abstract {}; // expected-warning {{made available}}
+struct __is_arithmetic {}; // expected-warning {{made available}}
+struct __is_array {}; // expected-warning {{made available}}
+struct __is_base_of {}; // expected-warning {{made available}}
+struct __is_class {}; // expected-warning {{made available}}
+struct __is_complete_type {}; // expected-warning {{made available}}
+struct __is_compound {}; // expected-warning {{made available}}
+struct __is_const {}; // expected-warning {{made available}}
+struct __is_constructible {}; // expected-warning {{made available}}
+struct __is_convertible {}; // expected-warning {{made available}}
+struct __is_convertible_to {}; // expected-warning {{made available}}
+struct __is_destructible {}; // expected-warning {{made available}}
+struct __is_enum {}; // expected-warning {{made available}}
+struct __is_floating_point {}; // expected-warning {{made available}}
+struct __is_final {}; // expected-warning {{made available}}
+struct __is_function {}; // expected-warning {{made available}}
+struct __is_fundamental {}; // expected-warning {{made available}}
+struct __is_integral {}; // expected-warning {{made available}}
+struct __is_interface_class {}; // expected-warning {{made available}}
+struct __is_literal {}; // expected-warning {{made available}}
+struct __is_lvalue_expr {}; // expected-warning {{made available}}
+struct __is_lvalue_reference {}; // expected-warning {{made available}}
+struct __is_member_function_pointer {}; // expected-warning {{made available}}
+struct __is_member_object_pointer {}; // expected-warning {{made available}}
+struct __is_member_pointer {}; // expected-warning {{made available}}
+struct __is_nothrow_assignable {}; // expected-warning {{made available}}
+struct __is_nothrow_constructible {}; // expected-warning {{made available}}
+struct __is_nothrow_destructible {}; // expected-warning {{made available}}
+struct __is_object {}; // expected-warning {{made available}}
+struct __is_pointer {}; // expected-warning {{made available}}
+struct __is_polymorphic {}; // expected-warning {{made available}}
+struct __is_reference {}; // expected-warning {{made available}}
+struct __is_rvalue_expr {}; // expected-warning {{made available}}
+struct __is_rvalue_reference {}; // expected-warning {{made available}}
+struct __is_same {}; // expected-warning {{made available}}
+struct __is_scalar {}; // expected-warning {{made available}}
+struct __is_sealed {}; // expected-warning {{made available}}
+struct __is_signed {}; // expected-warning {{made available}}
+struct __is_standard_layout {}; // expected-warning {{made available}}
+struct __is_trivial {}; // expected-warning {{made available}}
+struct __is_trivially_assignable {}; // expected-warning {{made available}}
+struct __is_trivially_constructible {}; // expected-warning {{made available}}
+struct __is_trivially_copyable {}; // expected-warning {{made available}}
+struct __is_union {}; // expected-warning {{made available}}
+struct __is_unsigned {}; // expected-warning {{made available}}
+struct __is_void {}; // expected-warning {{made available}}
+struct __is_volatile {}; // expected-warning {{made available}}
+
+
+}
diff --git a/test/PCH/cxx1y-lambdas.mm b/test/PCH/cxx1y-lambdas.mm
index ee4a2ba3ecc97..becf6cb642224 100644
--- a/test/PCH/cxx1y-lambdas.mm
+++ b/test/PCH/cxx1y-lambdas.mm
@@ -50,7 +50,7 @@ int add(int x, int y) {
}
// CHECK-PRINT: inline int add_int_slowly_twice
-// CHECK-PRINT: lambda = [] ($auto-0-0 z
+// CHECK-PRINT: lambda = [] (type-parameter-0-0 z
// CHECK-PRINT: init_capture
// CHECK-PRINT: [&, x( t )]
diff --git a/test/PCH/pragma-loop.cpp b/test/PCH/pragma-loop.cpp
index 1456a2778f33a..2640020f00077 100644
--- a/test/PCH/pragma-loop.cpp
+++ b/test/PCH/pragma-loop.cpp
@@ -10,11 +10,14 @@
// CHECK: #pragma clang loop unroll(disable)
// CHECK: #pragma clang loop interleave(disable)
// CHECK: #pragma clang loop vectorize(enable)
-// CHECK: #pragma clang loop unroll(enable)
+// CHECK: #pragma clang loop unroll(full)
// CHECK: #pragma clang loop interleave(enable)
// CHECK: #pragma clang loop vectorize(disable)
// CHECK: #pragma unroll
// CHECK: #pragma unroll (32)
+// CHECK: #pragma nounroll
+// CHECK: #pragma clang loop interleave_count(I)
+// CHECK: #pragma clang loop vectorize_width(V)
#ifndef HEADER
#define HEADER
@@ -47,7 +50,7 @@ public:
int i = 0;
#pragma clang loop vectorize(disable)
#pragma clang loop interleave(enable)
-#pragma clang loop unroll(enable)
+#pragma clang loop unroll(full)
while (i - 3 < Length) {
List[i] = i;
i++;
@@ -71,8 +74,25 @@ public:
i++;
}
}
-};
+ inline void run6(int *List, int Length) {
+ int i = 0;
+#pragma nounroll
+ while (i - 3 < Length) {
+ List[i] = i;
+ i++;
+ }
+ }
+
+ template <int V, int I>
+ inline void run7(int *List, int Length) {
+#pragma clang loop vectorize_width(V)
+#pragma clang loop interleave_count(I)
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+ }
+};
#else
void test() {
@@ -85,6 +105,8 @@ void test() {
pt.run3(List, 100);
pt.run4(List, 100);
pt.run5(List, 100);
+ pt.run6(List, 100);
+ pt.run7<2, 4>(List, 100);
}
#endif
diff --git a/test/PCH/pragma-optimize.c b/test/PCH/pragma-optimize.c
index 2206fe75cd829..9570117448e2a 100644
--- a/test/PCH/pragma-optimize.c
+++ b/test/PCH/pragma-optimize.c
@@ -5,6 +5,12 @@
// RUN: %clang_cc1 %s -emit-pch -o %t
// RUN: %clang_cc1 %s -emit-llvm -include-pch %t -o - | FileCheck %s
+// The first run line creates a pch, and since at that point HEADER is not
+// defined, the only thing contained in the pch is the pragma. The second line
+// then includes that pch, so HEADER is defined and the actual code is compiled.
+// The check then makes sure that the pragma is in effect in the file that
+// includes the pch.
+
// expected-no-diagnostics
#ifndef HEADER
diff --git a/test/PCH/stmt-attrs.cpp b/test/PCH/stmt-attrs.cpp
index 3d7c7a27a7e24..170e34975e624 100644
--- a/test/PCH/stmt-attrs.cpp
+++ b/test/PCH/stmt-attrs.cpp
@@ -1,24 +1,24 @@
-// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t.a %s
-// RUN: %clang_cc1 -std=c++11 -include-pch %t.a %s -ast-print -o - | FileCheck %s
-
-#ifndef HEADER
-#define HEADER
-
-inline void test(int i) {
- switch (i) {
- case 1:
- // Notice that the NullStmt has two attributes.
- // CHECK: {{\[\[clang::fallthrough\]\] \[\[clang::fallthrough\]\]}}
- [[clang::fallthrough]] [[clang::fallthrough]];
- case 2:
- break;
- }
-}
-
-#else
-
-void foo(void) {
- test(1);
-}
-
-#endif
+// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t.a %s
+// RUN: %clang_cc1 -std=c++11 -include-pch %t.a %s -ast-print -o - | FileCheck %s
+
+#ifndef HEADER
+#define HEADER
+
+inline void test(int i) {
+ switch (i) {
+ case 1:
+ // Notice that the NullStmt has two attributes.
+ // CHECK: {{\[\[clang::fallthrough\]\] \[\[clang::fallthrough\]\]}}
+ [[clang::fallthrough]] [[clang::fallthrough]];
+ case 2:
+ break;
+ }
+}
+
+#else
+
+void foo(void) {
+ test(1);
+}
+
+#endif
diff --git a/test/PCH/verify_pch.m b/test/PCH/verify_pch.m
index dcfb286e2a112..e905f2537c7f5 100644
--- a/test/PCH/verify_pch.m
+++ b/test/PCH/verify_pch.m
@@ -5,25 +5,25 @@
// RUN: cp %s %t.h
//
// Precompile
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -x objective-c-header -emit-pch -o %t.pch %t.h
+// RUN: %clang_cc1 -isystem %t/usr/include -x objective-c-header -emit-pch -o %t.pch %t.h
// Verify successfully
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch
+// RUN: %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch
// Incompatible lang options ignored
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -x objective-c -fno-builtin -verify-pch %t.pch
+// RUN: %clang_cc1 -isystem %t/usr/include -x objective-c -fno-builtin -verify-pch %t.pch
// Stale dependency
// RUN: echo ' ' >> %t.h
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch 2> %t.log.2
+// RUN: not %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch 2> %t.log.2
// RUN: FileCheck -check-prefix=CHECK-STALE-DEP %s < %t.log.2
// CHECK-STALE-DEP: file '{{.*}}.h' has been modified since the precompiled header '{{.*}}.pch' was built
// Stale dependency in system header
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -x objective-c-header -emit-pch -o %t.pch %t.h
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch
+// RUN: %clang_cc1 -isystem %t/usr/include -x objective-c-header -emit-pch -o %t.pch %t.h
+// RUN: %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch
// RUN: echo ' ' >> %t/usr/include/sys_header.h
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -isysroot %t -verify-pch %t.pch 2> %t.log.3
+// RUN: not %clang_cc1 -isystem %t/usr/include -verify-pch %t.pch 2> %t.log.3
// RUN: FileCheck -check-prefix=CHECK-STALE-SYS-H %s < %t.log.3
// CHECK-STALE-SYS-H: file '{{.*}}sys_header.h' has been modified since the precompiled header '{{.*}}.pch' was built