diff options
Diffstat (limited to 'clang/test/OpenMP')
-rw-r--r-- | clang/test/OpenMP/target_data_ast_print.cpp | 33 | ||||
-rw-r--r-- | clang/test/OpenMP/target_data_if_messages.cpp | 26 | ||||
-rw-r--r-- | clang/test/OpenMP/target_data_messages.c | 27 |
3 files changed, 86 insertions, 0 deletions
diff --git a/clang/test/OpenMP/target_data_ast_print.cpp b/clang/test/OpenMP/target_data_ast_print.cpp new file mode 100644 index 00000000000..ec60a22657c --- /dev/null +++ b/clang/test/OpenMP/target_data_ast_print.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +void foo() {} + +int main (int argc, char **argv) { + int b = argc, c, d, e, f, g; + static int a; +// CHECK: static int a; + +#pragma omp target data +// CHECK: #pragma omp target data + a=2; +// CHECK-NEXT: a = 2; +#pragma omp target data if (b) +// CHECK: #pragma omp target data if(b) + foo(); +// CHECK-NEXT: foo(); + +#pragma omp target data if (b > g) +// CHECK: #pragma omp target data if(b > g) + foo(); +// CHECK-NEXT: foo(); + + return (0); +} + +#endif diff --git a/clang/test/OpenMP/target_data_if_messages.cpp b/clang/test/OpenMP/target_data_if_messages.cpp new file mode 100644 index 00000000000..3a0e815798f --- /dev/null +++ b/clang/test/OpenMP/target_data_if_messages.cpp @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note {{declared here}} + +int main(int argc, char **argv) { + #pragma omp target data if // expected-error {{expected '(' after 'if'}} + #pragma omp target data if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target data if () // expected-error {{expected expression}} + #pragma omp target data if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target data if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target data' are ignored}} + #pragma omp target data if (argc > 0 ? argv[1] : argv[2]) + #pragma omp target data if (argc + argc) + #pragma omp target data if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target data' cannot contain more than one 'if' clause}} + #pragma omp target data if (S1) // expected-error {{'S1' does not refer to a value}} + #pragma omp target data if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); + + return 0; +} diff --git a/clang/test/OpenMP/target_data_messages.c b/clang/test/OpenMP/target_data_messages.c new file mode 100644 index 00000000000..cd60d85a903 --- /dev/null +++ b/clang/test/OpenMP/target_data_messages.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s + +void foo() { } + +int main(int argc, char **argv) { + L1: + foo(); + #pragma omp target data + { + foo(); + goto L1; // expected-error {{use of undeclared label 'L1'}} + } + goto L2; // expected-error {{use of undeclared label 'L2'}} + #pragma omp target data + L2: + foo(); + + #pragma omp target data(i) // expected-warning {{extra tokens at the end of '#pragma omp target data' are ignored}} + { + foo(); + } + #pragma omp target unknown // expected-warning {{extra tokens at the end of '#pragma omp target' are ignored}} + { + foo(); + } + return 0; +} |