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

David S via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 12:56:40 PDT 2016


davidsh created this revision.
davidsh added reviewers: kkwli0, hubert.reinterpretcast.
davidsh added a subscriber: cfe-commits.

Clang fails to diagnose cases such as 
#pragma omp target
  while(0) {
    #pragma omp teams
    {}
  }


http://reviews.llvm.org/D21617

Files:
  lib/Sema/SemaOpenMP.cpp

Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,10 @@
       }
       assert(I != CS->body_end() && "Not found statement");
       S = *I;
+    } else {
+      auto *OED = dyn_cast<OMPExecutableDirective>(S);
+      if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()))
+        OMPTeamsFound = false;
     }
     if (!OMPTeamsFound) {
       Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21617.61592.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160622/f2e151d4/attachment.bin>


More information about the cfe-commits mailing list