[flang] [OpenMP] parse tree changes for Sections/Parallel Sections constructs (flang...
authorJinxin (Brian) Yang <jinxiny@nvidia.com>
Wed, 14 Aug 2019 15:42:28 +0000 (08:42 -0700)
committerGitHub <noreply@github.com>
Wed, 14 Aug 2019 15:42:28 +0000 (08:42 -0700)
commite59305d7ae99a10355bef4e45a5a8351315e4006
treed089516604b45048f1d49c71ad63e6c4c2c216bd
parente688b2721014bc2d55a8dd6e8c8c580ccf46179b
[flang] [OpenMP] parse tree changes for Sections/Parallel Sections constructs (flang-compiler/f18#652)

```
!$omp sections [clause[ [,] clause] ... ]
[!$omp section]
structured-block
[!$omp section
structured-block]
...
!$omp end sections [nowait]
```

1. Following parse tree node changes for Block constructs, changing the
   Sections/Parallel Sections to `{Begin, Section-Blocks, End}`

2. Handles `!$omp section` in the parser, do not create parse tree node
   for this directive because basically it is a delimiter to split the
   code into different `Block`s within the Sections/Parallel Sections
   constructs. So, the `Section-Blocks` here is a `std::list` of `Block`s.
   (thanks to Tim's suggestion)

3. Modify check-omp-structure.* to avoid breaking existing tests

More tests will be added during Semantics. Also, similar to Block constructs,
the `Begin` and `End` directive matching will be done in future PR.

This commit also contains Peter's important fix for allowing "!$OMP END SECTION"
as a legal statement following `Block` (daf5630: Modify execution part error
recovery to not consume !$OMP SECTION).

Original-commit: flang-compiler/f18@75d016f6d27e73f5d559fe68d8a01df251c6d8cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/652
flang/lib/parser/dump-parse-tree.h
flang/lib/parser/openmp-grammar.h
flang/lib/parser/parse-tree.h
flang/lib/parser/stmt-parser.h
flang/lib/parser/unparse.cc
flang/lib/semantics/check-omp-structure.cc
flang/lib/semantics/check-omp-structure.h
flang/test/semantics/omp-clause-validity01.f90