[flang] [OpenMP] Implement no-multiple-appearance rule for DSA Clauses
authorJinxin Yang <jinxiny@nvidia.com>
Wed, 18 Sep 2019 00:52:46 +0000 (17:52 -0700)
committerJinxin (Brian) Yang <brianyang1106@gmail.com>
Fri, 25 Oct 2019 22:16:20 +0000 (15:16 -0700)
commit0554d39d74e8da3942869ccf8f2bfa31feea45a1
treeab10a4e56c4407387a25c04feb1c3e9aa4a878da
parentdf51352d72f4c18eb9c1b2259dd41f026887cd1c
[flang] [OpenMP] Implement no-multiple-appearance rule for DSA Clauses

DSA stands for Data-Sharing Attribute. This work is part of the
Name Resolution for OpenMP framework (data-refs on clauses part)

Based on 2.15.3: A list item that specifies a given variable may
not appear in more than one clause on the same directive, except that
a variable may be specified in both firstprivate and lastprivate clauses.

Through a temporary `std::set` of `const Symbol *` to keep track of
all the symbols on a certain OpenMP directive, we can determine whether
a variable `Name` (or `Symbol`, more accurately) has already appeared on
another DSA clause already, with the exception of FIRSTPRIVATE clause
and LASTPRIVATE clause. This rule applies to `/COMMON block/` also and
the source provenance shows on error message points to the `Name` between
slashes.

Added two more tests and changed some existing tests to accommodate
this commit. I intend to keep the `omp-clause-validity01.f90` test to
do the validity checks only.

Original-commit: flang-compiler/f18@0d7828c21e8dfe02e470a861178b7747100516ae
flang/lib/semantics/resolve-names.cc
flang/lib/semantics/symbol.h
flang/test/semantics/CMakeLists.txt
flang/test/semantics/omp-clause-validity01.f90
flang/test/semantics/omp-resolve02.f90
flang/test/semantics/omp-resolve04.f90 [new file with mode: 0644]
flang/test/semantics/omp-symbol02.f90
flang/test/semantics/omp-symbol06.f90 [new file with mode: 0644]