]> granicus.if.org Git - clang/commit
[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 1 Feb 2019 15:41:54 +0000 (15:41 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 1 Feb 2019 15:41:54 +0000 (15:41 +0000)
commitc87e623caa08f9378c2bcab96c2b2faaf553d07b
tree0ab1cc6d54901f5ba03832f826108a335b181f4f
parenta576b39f62ffcaa7241ef6606721239cdbe1fa0e
[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks

Summary:
I'm working on a clang-tidy check, much like existing [[ http://clang.llvm.org/extra/clang-tidy/checks/bugprone-exception-escape.html | bugprone-exception-escape ]],
to detect when an exception might escape out of an OpenMP construct it isn't supposed to escape from.
For that i will be using the `nothrow` bit of `CapturedDecl`s.

While that bit is already correctly set for some constructs, e.g. `#pragma omp parallel`: https://godbolt.org/z/2La7pv
it isn't set for the `#pragma omp sections`, or `#pragma omp section`: https://godbolt.org/z/qZ-EbP

If i'm reading [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf | `OpenMP Application Programming Interface Version 5.0 November 2018` ]] correctly,
they should be, as per `2.8.1 sections Construct`, starting with page 86:
* The sections construct is a non-iterative worksharing construct that contains a set of **structured blocks**
  that are to be distributed among and executed by the threads in a team. Each **structured block** is executed
  once by one of the threads in the team in the context of its implicit task.
* The syntax of the sections construct is as follows:
  #pragma omp sections [clause[ [,] clause] ... ] new-line
    {
      [#pragma omp section new-line]
        **structured-block**
   ...
* Description
  Each **structured block** in the sections construct is preceded by a section directive except
  possibly **the first block**, for which a preceding section directive is optional.

* Restrictions
  • The code enclosed in a sections construct must be a **structured block**.
  * A throw executed inside a sections region must cause execution to resume within the same
    section of the sections region, and the same thread that threw the exception must catch it.

Reviewers: ABataev, #openmp

Reviewed By: ABataev

Subscribers: guansong, openmp-commits, cfe-commits

Tags: #clang, #openmp

Differential Revision: https://reviews.llvm.org/D57585

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352882 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaOpenMP.cpp
test/AST/ast-dump-openmp-sections.cpp [new file with mode: 0644]