diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
commit | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch) | |
tree | c72b9241553fc9966179aba84f90f17bfa9235c3 /test/PCH | |
parent | b52119637f743680a99710ce5fdb6646da2772af (diff) |
Notes
Diffstat (limited to 'test/PCH')
-rw-r--r-- | test/PCH/cxx-dependent-sized-ext-vector.cpp | 18 | ||||
-rw-r--r-- | test/PCH/cxx-traits.cpp | 1 | ||||
-rw-r--r-- | test/PCH/cxx-traits.h | 1 | ||||
-rw-r--r-- | test/PCH/emit-dependencies.c | 9 | ||||
-rw-r--r-- | test/PCH/macro-undef.cpp | 6 | ||||
-rw-r--r-- | test/PCH/ocl_types.h | 3 | ||||
-rw-r--r-- | test/PCH/pragma-pack.c | 90 |
7 files changed, 122 insertions, 6 deletions
diff --git a/test/PCH/cxx-dependent-sized-ext-vector.cpp b/test/PCH/cxx-dependent-sized-ext-vector.cpp new file mode 100644 index 0000000000000..29c06f7cc797d --- /dev/null +++ b/test/PCH/cxx-dependent-sized-ext-vector.cpp @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -std=c++11 -emit-pch %s -o %t +// RUN: %clang_cc1 -std=c++11 -include-pch %t -verify %s + +#ifndef HEADER_INCLUDED + +#define HEADER_INCLUDED + +template<typename T, int N> +using vec = T __attribute__((ext_vector_type(N))); + +#else + +void test() { + vec<float, 2> a; // expected-error@-5 {{zero vector size}} + vec<float, 0> b; // expected-note {{in instantiation of template type alias 'vec' requested here}} +} + +#endif diff --git a/test/PCH/cxx-traits.cpp b/test/PCH/cxx-traits.cpp index b0f1d9d2c3deb..01b9e9302d790 100644 --- a/test/PCH/cxx-traits.cpp +++ b/test/PCH/cxx-traits.cpp @@ -16,6 +16,7 @@ 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_aggregate_result = __is_aggregate(int); bool _is_arithmetic_result = __is_arithmetic(int); bool _is_array_result = __is_array(int); bool _is_assignable_result = __is_assignable(int, int); diff --git a/test/PCH/cxx-traits.h b/test/PCH/cxx-traits.h index 1d7d40450fe2d..0a4bd09c363e9 100644 --- a/test/PCH/cxx-traits.h +++ b/test/PCH/cxx-traits.h @@ -18,6 +18,7 @@ struct is_trivially_constructible { }; struct __is_abstract {}; // expected-warning {{made available}} +struct __is_aggregate {}; // expected-warning {{made available}} struct __is_arithmetic {}; // expected-warning {{made available}} struct __is_array {}; // expected-warning {{made available}} struct __is_assignable {}; // expected-warning {{made available}} diff --git a/test/PCH/emit-dependencies.c b/test/PCH/emit-dependencies.c new file mode 100644 index 0000000000000..c4bccf8bb1a69 --- /dev/null +++ b/test/PCH/emit-dependencies.c @@ -0,0 +1,9 @@ +// RUN: rm -f %t.pch +// RUN: %clang_cc1 -emit-pch -o %t.pch %S/Inputs/chain-decls1.h +// RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -MT %s.o -dependency-file - %s | FileCheck %s +// CHECK: chain-decls1.h + +int main() { + f(); + return 0; +} diff --git a/test/PCH/macro-undef.cpp b/test/PCH/macro-undef.cpp index c0ce2de23fe32..bfe87d12b2083 100644 --- a/test/PCH/macro-undef.cpp +++ b/test/PCH/macro-undef.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -emit-pch -o %t %s -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify -// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify +// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s #ifndef HEADER #define HEADER diff --git a/test/PCH/ocl_types.h b/test/PCH/ocl_types.h index bdc4bb11c1b2e..96391289f7f3c 100644 --- a/test/PCH/ocl_types.h +++ b/test/PCH/ocl_types.h @@ -32,9 +32,6 @@ typedef clk_event_t clkevt_t; // queue_t typedef queue_t q_t; -// ndrange_t -typedef ndrange_t range_t; - // reserve_id_t typedef reserve_id_t reserveid_t; diff --git a/test/PCH/pragma-pack.c b/test/PCH/pragma-pack.c new file mode 100644 index 0000000000000..47a5570023518 --- /dev/null +++ b/test/PCH/pragma-pack.c @@ -0,0 +1,90 @@ +// Test this without pch. +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DSET +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DRESET +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DPUSH +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DPUSH_POP +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -include %s -verify -fsyntax-only -DPUSH_POP_LABEL + +// Test with pch. +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DSET -emit-pch -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DSET -verify -include-pch %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DRESET -emit-pch -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DRESET -verify -include-pch %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH -emit-pch -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH -verify -include-pch %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP -emit-pch -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP -verify -include-pch %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP_LABEL -emit-pch -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 %s -DPUSH_POP_LABEL -verify -include-pch %t + +#ifndef HEADER +#define HEADER + +#ifdef SET +#pragma pack(1) +#endif + +#ifdef RESET +#pragma pack(2) +#pragma pack () +#endif + +#ifdef PUSH +#pragma pack(1) +#pragma pack (push, 2) +#endif + +#ifdef PUSH_POP +#pragma pack (push, 4) +#pragma pack (push, 2) +#pragma pack (pop) +#endif + +#ifdef PUSH_POP_LABEL +#pragma pack (push, a, 4) +#pragma pack (push, b, 1) +#pragma pack (push, c, 2) +#pragma pack (pop, b) +#endif + +#else + +#ifdef SET +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}} +#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}} +#endif + +#ifdef RESET +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}} +#pragma () +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}} +#endif + +#ifdef PUSH +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 2}} +#pragma pack(pop) +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 1}} +#pragma pack () +#pragma pack (show) // expected-warning {{value of #pragma pack(show) == 8}} +#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}} +#endif + +#ifdef PUSH_POP +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}} +#pragma pack(pop) +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}} +#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}} +#endif + +#ifdef PUSH_POP_LABEL +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}} +#pragma pack(pop, c) +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}} +#pragma pack(pop, a) +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}} +#pragma pack(pop) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}} +#pragma pack(pop, b) // expected-warning {{#pragma pack(pop, ...) failed: stack empty}} +#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}} +#endif + +#endif |