[PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

David S via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 24 13:49:44 PDT 2016


davidsh updated this revision to Diff 61830.
davidsh added a comment.

Address a comment.


http://reviews.llvm.org/D21617

Files:
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nesting_of_regions.cpp

Index: test/OpenMP/nesting_of_regions.cpp
===================================================================
--- test/OpenMP/nesting_of_regions.cpp
+++ test/OpenMP/nesting_of_regions.cpp
@@ -2867,6 +2867,12 @@
 #pragma omp teams  // expected-note {{nested teams construct here}}
     ++a;
   }
+#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
+  {
+    while (0)      // expected-note {{statement outside teams construct here}}
+#pragma omp teams  // expected-note {{nested teams construct here}}
+    ++a;
+  }
 #pragma omp target
   {
 #pragma omp taskloop
Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,9 @@
       }
       assert(I != CS->body_end() && "Not found statement");
       S = *I;
+    } else {
+      auto *OED = dyn_cast<OMPExecutableDirective>(S);
+      OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind());
     }
     if (!OMPTeamsFound) {
       Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21617.61830.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160624/6ee4a10e/attachment.bin>


More information about the cfe-commits mailing list