diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-23 10:25:33 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-23 10:25:33 +0000 |
commit | 67a4f22f12b07c48f1779b3716f6b369c8a1a830 (patch) | |
tree | f83b1b681f3851e697e5c2d70499e142badf92ed /clang/test/OpenMP/atomic_messages.cpp | |
parent | c92717f2f6f024e2f2435b6e1e45a873bc14449f (diff) | |
download | bcm5719-llvm-67a4f22f12b07c48f1779b3716f6b369c8a1a830.tar.gz bcm5719-llvm-67a4f22f12b07c48f1779b3716f6b369c8a1a830.zip |
[OPENMP] Initial parsing and sema analysis for 'update' clause of 'atomic' directive.
llvm-svn: 213735
Diffstat (limited to 'clang/test/OpenMP/atomic_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/atomic_messages.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/clang/test/OpenMP/atomic_messages.cpp b/clang/test/OpenMP/atomic_messages.cpp index 4bc7686c112..d7856cc229a 100644 --- a/clang/test/OpenMP/atomic_messages.cpp +++ b/clang/test/OpenMP/atomic_messages.cpp @@ -4,12 +4,14 @@ int foo() { L1: foo(); #pragma omp atomic +// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} { foo(); goto L1; // expected-error {{use of undeclared label 'L1'}} } goto L2; // expected-error {{use of undeclared label 'L2'}} #pragma omp atomic +// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} { foo(); L2: @@ -74,6 +76,41 @@ int write() { } template <class T> +T update() { + T a, b = 0; +// Test for atomic update +#pragma omp atomic update +// expected-error@+1 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + ; +// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}} +#pragma omp atomic update update + a += b; + +#pragma omp atomic +// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + ; + + return T(); +} + +int update() { + int a, b = 0; +// Test for atomic update +#pragma omp atomic update +// expected-error@+1 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + ; +// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}} +#pragma omp atomic update update + a += b; + +#pragma omp atomic +// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + ; + + return update<int>(); +} + +template <class T> T mixed() { T a, b = T(); // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} @@ -84,6 +121,10 @@ T mixed() { // expected-note@+1 2 {{'write' clause used here}} #pragma omp atomic write read a = b; +// expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} +// expected-note@+1 2 {{'update' clause used here}} +#pragma omp atomic update read + a += b; return T(); } @@ -97,6 +138,10 @@ int mixed() { // expected-note@+1 {{'write' clause used here}} #pragma omp atomic write read a = b; +// expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} +// expected-note@+1 {{'write' clause used here}} +#pragma omp atomic write update + a = b; // expected-note@+1 {{in instantiation of function template specialization 'mixed<int>' requested here}} return mixed<int>(); } |