Page MenuHomePhabricator

[AST][OpenMP] OpenMP Sections / Section constructs contain Structured blocks
ClosedPublic

Authored by lebedev.ri on Feb 1 2019, 6:54 AM.

Details

Summary

I'm working on a clang-tidy check, much like existing 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 CapturedDecls.

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 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.

Diff Detail

Repository
rC Clang

Event Timeline

lebedev.ri created this revision.Feb 1 2019, 6:54 AM
This revision is now accepted and ready to land.Feb 1 2019, 6:56 AM

LG

Okay, that sounds promising, thank you for the review!

This revision was automatically updated to reflect the committed changes.