summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/atomic_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-24 08:55:34 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-24 08:55:34 +0000
commit82bad8b02649d6d28039f6c5d43618753077d5b0 (patch)
treef690d9fdb03a0de406a6f59461791b2e54b54368 /clang/test/OpenMP/atomic_messages.cpp
parentc1730e9bb9a9a8c4e222d65a1964265d0622f423 (diff)
downloadbcm5719-llvm-82bad8b02649d6d28039f6c5d43618753077d5b0.tar.gz
bcm5719-llvm-82bad8b02649d6d28039f6c5d43618753077d5b0.zip
[OPENMP] Initial parsing and sema analysis for clause 'seq_cst' of 'atomic' directive.
llvm-svn: 213846
Diffstat (limited to 'clang/test/OpenMP/atomic_messages.cpp')
-rw-r--r--clang/test/OpenMP/atomic_messages.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/OpenMP/atomic_messages.cpp b/clang/test/OpenMP/atomic_messages.cpp
index 66f7c9db64b..b53133f3524 100644
--- a/clang/test/OpenMP/atomic_messages.cpp
+++ b/clang/test/OpenMP/atomic_messages.cpp
@@ -144,6 +144,41 @@ int capture() {
}
template <class T>
+T seq_cst() {
+ T a, b = 0;
+// Test for atomic seq_cst
+#pragma omp atomic seq_cst
+ // 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}}
+ ;
+// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}}
+#pragma omp atomic seq_cst seq_cst
+ a += b;
+
+#pragma omp atomic update seq_cst
+ // 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}}
+ ;
+
+ return T();
+}
+
+int seq_cst() {
+ int a, b = 0;
+// Test for atomic seq_cst
+#pragma omp atomic seq_cst
+ // 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}}
+ ;
+// expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}}
+#pragma omp atomic seq_cst seq_cst
+ a += b;
+
+#pragma omp atomic update seq_cst
+ // 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}}
+ ;
+
+ return seq_cst<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}}
OpenPOWER on IntegriCloud