diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-23 02:27:21 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-23 02:27:21 +0000 |
commit | f98b00c33e83cb507c21107e8c56961a4b043509 (patch) | |
tree | b8df40845ba99247ce32566d7297478b0830225b /clang/test/OpenMP/atomic_messages.cpp | |
parent | 6310757568fa3e6433435206102bf2d0cc4300e2 (diff) | |
download | bcm5719-llvm-f98b00c33e83cb507c21107e8c56961a4b043509.tar.gz bcm5719-llvm-f98b00c33e83cb507c21107e8c56961a4b043509.zip |
[OPENMP] Initial parsing and sema analysis for 'read' clause in 'atomic' directive.
llvm-svn: 213717
Diffstat (limited to 'clang/test/OpenMP/atomic_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/atomic_messages.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/clang/test/OpenMP/atomic_messages.cpp b/clang/test/OpenMP/atomic_messages.cpp index 6eef8f227df..7b35e42dc79 100644 --- a/clang/test/OpenMP/atomic_messages.cpp +++ b/clang/test/OpenMP/atomic_messages.cpp @@ -1,20 +1,47 @@ // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s int foo() { - L1: - foo(); - #pragma omp atomic +L1: + foo(); +#pragma omp atomic { foo(); goto L1; // expected-error {{use of undeclared label 'L1'}} } goto L2; // expected-error {{use of undeclared label 'L2'}} - #pragma omp atomic +#pragma omp atomic { foo(); - L2: + L2: foo(); } return 0; } + +template <class T> +T read() { + T a, b = 0; +// Test for atomic read +#pragma omp atomic read +// expected-error@+1 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both l-value expressions with scalar type}} + ; +// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} +#pragma omp atomic read read + a = b; + + return T(); +} + +int read() { + int a, b = 0; +// Test for atomic read +#pragma omp atomic read +// expected-error@+1 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both l-value expressions with scalar type}} + ; +// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} +#pragma omp atomic read read + a = b; + + return read<int>(); +} |