[flang][OpenMP] Semantic checks for GROUPPRIVATE by kparzysz · Pull Request #154779 · llvm/llvm-project (original) (raw)

@llvm/pr-subscribers-flang-semantics

@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)

Changes


Full diff: https://github.com/llvm/llvm-project/pull/154779.diff

5 Files Affected:

diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h index 5bde9f39ca0b0..f0e11ec3dc6e8 100644 --- a/flang/include/flang/Semantics/symbol.h +++ b/flang/include/flang/Semantics/symbol.h @@ -823,7 +823,7 @@ class Symbol { OmpThreadprivate, OmpDeclareReduction, OmpFlushed, OmpCriticalLock, OmpIfSpecified, OmpNone, OmpPreDetermined, OmpExplicit, OmpImplicit, OmpDependObject, OmpInclusiveScan, OmpExclusiveScan, OmpInScanReduction,

diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 92a2cfc330d35..142423b16334f 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -1184,6 +1184,53 @@ void OmpStructureChecker::CheckThreadprivateOrDeclareTargetVar( void OmpStructureChecker::Enter(const parser::OpenMPGroupprivate &x) { PushContextAndClauseSets( x.v.DirName().source, llvm::omp::Directive::OMPD_groupprivate); +

void OmpStructureChecker::Leave(const parser::OpenMPGroupprivate &x) { diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp index 6a4660c9882ab..96d95162beb73 100644 --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -391,6 +391,9 @@ class OmpAttributeVisitor : DirectiveAttributeVisitorllvm::omp::Directive { GetContext().withinConstruct = true; }

@@ -842,7 +845,8 @@ class OmpAttributeVisitor : DirectiveAttributeVisitorllvm::omp::Directive {

Symbol::Flags ompFlagsRequireMark{Symbol::Flag::OmpThreadprivate, Symbol::Flag::OmpDeclareTarget, Symbol::Flag::OmpExclusiveScan,

@@ -2118,6 +2122,18 @@ void OmpAttributeVisitor::CheckAssocLoopLevel( } }

+bool OmpAttributeVisitor::Pre(const parser::OpenMPGroupprivate &x) {

diff --git a/flang/lib/Semantics/unparse-with-symbols.cpp b/flang/lib/Semantics/unparse-with-symbols.cpp index 41077e0e0aad7..b199481131065 100644 --- a/flang/lib/Semantics/unparse-with-symbols.cpp +++ b/flang/lib/Semantics/unparse-with-symbols.cpp @@ -47,6 +47,11 @@ class SymbolDumpVisitor { return true; } void Post(const parser::OmpClause &) { currStmt_ = std::nullopt; }