[Openmp-commits] [PATCH] D57585: [AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks

Phabricator via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 1 07:41:47 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC352882: [AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks (authored by lebedevri, committed by ).

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57585/new/

https://reviews.llvm.org/D57585

Files:
  lib/Sema/SemaOpenMP.cpp
  test/AST/ast-dump-openmp-sections.cpp


Index: test/AST/ast-dump-openmp-sections.cpp
===================================================================
--- test/AST/ast-dump-openmp-sections.cpp
+++ test/AST/ast-dump-openmp-sections.cpp
@@ -0,0 +1,57 @@
+// RUN: %clang_cc1 -verify -fopenmp -ast-dump %s | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp-simd -ast-dump %s | FileCheck %s
+// expected-no-diagnostics
+
+void sections() {
+#pragma omp sections
+  {
+#pragma omp section
+    {
+    }
+#pragma omp section
+    {
+    }
+  }
+}
+
+// CHECK: `-FunctionDecl
+// CHECK-NEXT:   `-CompoundStmt
+// CHECK-NEXT:     `-OMPSectionsDirective
+// CHECK-NEXT:       `-CapturedStmt
+// CHECK-NEXT:         `-CapturedDecl {{.*}} nothrow
+// CHECK-NEXT:           |-CompoundStmt
+// CHECK-NEXT:           | |-OMPSectionDirective
+// CHECK-NEXT:           | | `-CapturedStmt
+// CHECK-NEXT:           | |   `-CapturedDecl {{.*}} nothrow
+// CHECK-NEXT:           | |     |-CompoundStmt
+// CHECK-NEXT:           | |     `-ImplicitParamDecl
+// CHECK-NEXT:           | `-OMPSectionDirective
+// CHECK-NEXT:           |   `-CapturedStmt
+// CHECK-NEXT:           |     `-CapturedDecl {{.*}} nothrow
+// CHECK-NEXT:           |       |-CompoundStmt
+// CHECK-NEXT:           |       `-ImplicitParamDecl
+// CHECK-NEXT:           |-ImplicitParamDecl
+// CHECK-NEXT:           |-CXXRecordDecl
+// CHECK-NEXT:           | |-DefinitionData
+// CHECK-NEXT:           | | |-DefaultConstructor
+// CHECK-NEXT:           | | |-CopyConstructor
+// CHECK-NEXT:           | | |-MoveConstructor
+// CHECK-NEXT:           | | |-CopyAssignment
+// CHECK-NEXT:           | | |-MoveAssignment
+// CHECK-NEXT:           | | `-Destructor
+// CHECK-NEXT:           | `-CapturedRecordAttr
+// CHECK-NEXT:           |-CapturedDecl {{.*}} nothrow
+// CHECK-NEXT:           | |-CompoundStmt
+// CHECK-NEXT:           | `-ImplicitParamDecl
+// CHECK-NEXT:           |-CXXRecordDecl
+// CHECK-NEXT:           | |-DefinitionData
+// CHECK-NEXT:           | | |-DefaultConstructor
+// CHECK-NEXT:           | | |-CopyConstructor
+// CHECK-NEXT:           | | |-MoveConstructor
+// CHECK-NEXT:           | | |-CopyAssignment
+// CHECK-NEXT:           | | |-MoveAssignment
+// CHECK-NEXT:           | | `-Destructor
+// CHECK-NEXT:           | `-CapturedRecordAttr
+// CHECK-NEXT:           `-CapturedDecl {{.*}} nothrow
+// CHECK-NEXT:             |-CompoundStmt
+// CHECK-NEXT:             `-ImplicitParamDecl
Index: lib/Sema/SemaOpenMP.cpp
===================================================================
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -5969,6 +5969,13 @@
     return StmtError();
   }
 
+  // 1.2.2 OpenMP Language Terminology
+  // Structured block - An executable statement with a single entry at the
+  // top and a single exit at the bottom.
+  // The point of exit cannot be a branch out of the structured block.
+  // longjmp() and throw() must not violate the entry/exit criteria.
+  cast<CapturedStmt>(AStmt)->getCapturedDecl()->setNothrow();
+
   setFunctionHasBranchProtectedScope();
 
   return OMPSectionsDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
@@ -5983,6 +5990,13 @@
 
   assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
 
+  // 1.2.2 OpenMP Language Terminology
+  // Structured block - An executable statement with a single entry at the
+  // top and a single exit at the bottom.
+  // The point of exit cannot be a branch out of the structured block.
+  // longjmp() and throw() must not violate the entry/exit criteria.
+  cast<CapturedStmt>(AStmt)->getCapturedDecl()->setNothrow();
+
   setFunctionHasBranchProtectedScope();
   DSAStack->setParentCancelRegion(DSAStack->isCancelRegion());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57585.184756.patch
Type: text/x-patch
Size: 3710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190201/0e62037f/attachment-0001.bin>


More information about the Openmp-commits mailing list