Skip to content

Commit 0000030

Browse files
Revert "[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate and Lastprivate clauses."
This reverts commit a2ca6bb. D93213 performs some checks to ensure that variables that appear in statement functions are not in privatisation clauses. The point at which this check is currently performed, there can be misparses that cause more constructs to be identified as statement functions. This can lead to various kinds of errors, hence reverting. This revert hopefully fixes: llvm/llvm-project#54477 llvm/llvm-project#54161 llvm/llvm-project#54163 Reviewed By: shraiysh Differential Revision: https://reviews.llvm.org/D122650
1 parent baebf23 commit 0000030

File tree

2 files changed

+3
-62
lines changed

2 files changed

+3
-62
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,6 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
279279
return true;
280280
}
281281

282-
bool Pre(const parser::StmtFunctionStmt &x) {
283-
const auto &parsedExpr{std::get<parser::Scalar<parser::Expr>>(x.t)};
284-
if (const auto *expr{GetExpr(parsedExpr)}) {
285-
for (const Symbol &symbol : evaluate::CollectSymbols(*expr)) {
286-
if (!IsStmtFunctionDummy(symbol)) {
287-
stmtFunctionExprSymbols_.insert(symbol.GetUltimate());
288-
}
289-
}
290-
}
291-
return true;
292-
}
293-
294282
bool Pre(const parser::OpenMPBlockConstruct &);
295283
void Post(const parser::OpenMPBlockConstruct &);
296284

@@ -530,7 +518,7 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
530518
void CheckDataCopyingClause(
531519
const parser::Name &, const Symbol &, Symbol::Flag);
532520
void CheckAssocLoopLevel(std::int64_t level, const parser::OmpClause *clause);
533-
void CheckPrivateDSAObject(
521+
void CheckObjectInNamelist(
534522
const parser::Name &, const Symbol &, Symbol::Flag);
535523
void CheckSourceLabel(const parser::Label &);
536524
void CheckLabelContext(const parser::CharBlock, const parser::CharBlock,
@@ -1585,7 +1573,7 @@ void OmpAttributeVisitor::ResolveOmpObject(
15851573
CheckMultipleAppearances(*name, *symbol, ompFlag);
15861574
}
15871575
if (privateDataSharingAttributeFlags.test(ompFlag)) {
1588-
CheckPrivateDSAObject(*name, *symbol, ompFlag);
1576+
CheckObjectInNamelist(*name, *symbol, ompFlag);
15891577
}
15901578

15911579
if (ompFlag == Symbol::Flag::OmpAllocate) {
@@ -1779,7 +1767,7 @@ void OmpAttributeVisitor::CheckDataCopyingClause(
17791767
}
17801768
}
17811769

1782-
void OmpAttributeVisitor::CheckPrivateDSAObject(
1770+
void OmpAttributeVisitor::CheckObjectInNamelist(
17831771
const parser::Name &name, const Symbol &symbol, Symbol::Flag ompFlag) {
17841772
const auto &ultimateSymbol{symbol.GetUltimate()};
17851773
llvm::StringRef clauseName{"PRIVATE"};
@@ -1794,14 +1782,6 @@ void OmpAttributeVisitor::CheckPrivateDSAObject(
17941782
"Variable '%s' in NAMELIST cannot be in a %s clause"_err_en_US,
17951783
name.ToString(), clauseName.str());
17961784
}
1797-
1798-
if (stmtFunctionExprSymbols_.find(ultimateSymbol) !=
1799-
stmtFunctionExprSymbols_.end()) {
1800-
context_.Say(name.source,
1801-
"Variable '%s' in STATEMENT FUNCTION expression cannot be in a "
1802-
"%s clause"_err_en_US,
1803-
name.ToString(), clauseName.str());
1804-
}
18051785
}
18061786

18071787
void OmpAttributeVisitor::CheckSourceLabel(const parser::Label &label) {

flang/test/Semantics/omp-private03.f90

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)