[flang] OpenMP structural check framework (PARALLEL as example) (flang-compiler/f18...
authorJinxin (Brian) Yang <jinxiny@nvidia.com>
Tue, 25 Jun 2019 23:18:51 +0000 (16:18 -0700)
committerGitHub <noreply@github.com>
Tue, 25 Jun 2019 23:18:51 +0000 (16:18 -0700)
commit125f29535332b3940e124bd356b51424ea955740
tree9362448940dcc636cc3df50c916194b5ad750dbc
parent69f5f1373867f2bf38c58edb1ab82be8f90cb2c5
[flang] OpenMP structural check framework (PARALLEL as example) (flang-compiler/f18#493)

This patch is to show the framework to do OpenMP structure related check and you may find missing/incomplete implementation, which will be added in the future.

1. Each encountering construct has its own context and the context info will be filled while walking the directive/clause nodes. In the `Leave`, the current OpenMP context will be popped out.

2. When entering the construct, necessary nesting check will be performed. Use std::vector to implement the context stack because certain nesting restrictions may need to trace back more than one level.

3. PARALLEL construct is used as an example for clause validity check.

4. `EnumSet` is used to represent the directive/clause sets and to show the error msg. All the error msgs are quoted from the specification.

5. Necessary `CharBlock` is added for error msgs.

Original-commit: flang-compiler/f18@620441c03e21ae28aed3864b9581cd6cc1705c65
Reviewed-on: https://github.com/flang-compiler/f18/pull/493
flang/lib/parser/openmp-grammar.h
flang/lib/parser/parse-tree.h
flang/lib/semantics/CMakeLists.txt
flang/lib/semantics/check-omp-structure.cc [new file with mode: 0644]
flang/lib/semantics/check-omp-structure.h [new file with mode: 0644]
flang/lib/semantics/semantics.cc
flang/test/semantics/CMakeLists.txt
flang/test/semantics/omp-clause-validity01.f90 [new file with mode: 0644]
flang/test/semantics/omp-nested01.f90 [new file with mode: 0644]