summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/taskyield_messages.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-02-15 00:27:53 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-02-15 00:27:53 +0000
commita6e8d5e554080ee5483d95313b2958cd25860990 (patch)
treeb4ae70697daf8e697bf7c9fc15c008393d3ba9ae /clang/test/OpenMP/taskyield_messages.cpp
parent6dbe86597a8fefc6c9783ee420508ec9dbabd03a (diff)
downloadbcm5719-llvm-a6e8d5e554080ee5483d95313b2958cd25860990.tar.gz
bcm5719-llvm-a6e8d5e554080ee5483d95313b2958cd25860990.zip
PR40642: Fix determination of whether the final statement of a statement
expression is a discarded-value expression. Summary: We used to get this wrong in three ways: 1) During parsing, an expression-statement followed by the }) ending a statement expression was always treated as producing the value of the statement expression. That's wrong for ({ if (1) expr; }) 2) During template instantiation, various kinds of statement (most statements not appearing directly in a compound-statement) were not treated as discarded-value expressions, resulting in missing volatile loads (etc). 3) In all contexts, an expression-statement with attributes was not treated as producing the value of the statement expression, eg ({ [[attr]] expr; }). Also fix incorrect enforcement of OpenMP rule that directives can "only be placed in the program at a position where ignoring or deleting the directive would result in a program with correct syntax". In particular, a label (be it goto, case, or default) should not affect whether directives are permitted. Reviewers: aaron.ballman, rjmccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57984 llvm-svn: 354090
Diffstat (limited to 'clang/test/OpenMP/taskyield_messages.cpp')
-rw-r--r--clang/test/OpenMP/taskyield_messages.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/clang/test/OpenMP/taskyield_messages.cpp b/clang/test/OpenMP/taskyield_messages.cpp
index fd98a8786f1..48f741df915 100644
--- a/clang/test/OpenMP/taskyield_messages.cpp
+++ b/clang/test/OpenMP/taskyield_messages.cpp
@@ -29,7 +29,7 @@ T tmain(T argc) {
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
switch (argc)
case 1:
-#pragma omp taskyield
+#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
switch (argc)
case 1: {
#pragma omp taskyield
@@ -49,10 +49,13 @@ T tmain(T argc) {
#pragma omp taskyield
}
label:
-#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
+#pragma omp taskyield
label1 : {
#pragma omp taskyield
}
+if (1)
+ label2:
+#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
return T();
}
@@ -83,7 +86,7 @@ int main(int argc, char **argv) {
#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
switch (argc)
case 1:
-#pragma omp taskyield
+#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
switch (argc)
case 1: {
#pragma omp taskyield
@@ -103,10 +106,13 @@ int main(int argc, char **argv) {
#pragma omp taskyield
}
label:
-#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
+#pragma omp taskyield
label1 : {
#pragma omp taskyield
}
+if (1)
+ label2:
+#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
return tmain(argc);
}
OpenPOWER on IntegriCloud