aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/check-omp-atomic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Semantics/check-omp-atomic.cpp')
-rw-r--r--flang/lib/Semantics/check-omp-atomic.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/flang/lib/Semantics/check-omp-atomic.cpp b/flang/lib/Semantics/check-omp-atomic.cpp
index c5ed879..eca50c1 100644
--- a/flang/lib/Semantics/check-omp-atomic.cpp
+++ b/flang/lib/Semantics/check-omp-atomic.cpp
@@ -197,7 +197,8 @@ static std::pair<parser::CharBlock, parser::CharBlock> SplitAssignmentSource(
}
static bool IsCheckForAssociated(const SomeExpr &cond) {
- return GetTopLevelOperation(cond).first == operation::Operator::Associated;
+ return GetTopLevelOperationIgnoreResizing(cond).first ==
+ operation::Operator::Associated;
}
static bool IsMaybeAtomicWrite(const evaluate::Assignment &assign) {
@@ -399,8 +400,8 @@ OmpStructureChecker::CheckUpdateCapture(
// subexpression of the right-hand side.
// 2. An assignment could be a capture (cbc) if the right-hand side is
// a variable (or a function ref), with potential type conversions.
- bool cbu1{IsSubexpressionOf(as1.lhs, as1.rhs)}; // Can as1 be an update?
- bool cbu2{IsSubexpressionOf(as2.lhs, as2.rhs)}; // Can as2 be an update?
+ bool cbu1{IsVarSubexpressionOf(as1.lhs, as1.rhs)}; // Can as1 be an update?
+ bool cbu2{IsVarSubexpressionOf(as2.lhs, as2.rhs)}; // Can as2 be an update?
bool cbc1{IsVarOrFunctionRef(GetConvertInput(as1.rhs))}; // Can 1 be capture?
bool cbc2{IsVarOrFunctionRef(GetConvertInput(as2.rhs))}; // Can 2 be capture?
@@ -607,7 +608,7 @@ void OmpStructureChecker::CheckAtomicUpdateAssignment(
std::pair<operation::Operator, std::vector<SomeExpr>> top{
operation::Operator::Unknown, {}};
if (auto &&maybeInput{GetConvertInput(update.rhs)}) {
- top = GetTopLevelOperation(*maybeInput);
+ top = GetTopLevelOperationIgnoreResizing(*maybeInput);
}
switch (top.first) {
case operation::Operator::Add:
@@ -657,7 +658,7 @@ void OmpStructureChecker::CheckAtomicUpdateAssignment(
if (IsSameOrConvertOf(arg, atom)) {
++count;
} else {
- if (!subExpr && IsSubexpressionOf(atom, arg)) {
+ if (!subExpr && evaluate::IsVarSubexpressionOf(atom, arg)) {
subExpr = arg;
}
nonAtom.push_back(arg);
@@ -715,7 +716,7 @@ void OmpStructureChecker::CheckAtomicConditionalUpdateAssignment(
CheckAtomicVariable(atom, alsrc);
- auto top{GetTopLevelOperation(cond)};
+ auto top{GetTopLevelOperationIgnoreResizing(cond)};
// Missing arguments to operations would have been diagnosed by now.
switch (top.first) {
@@ -1105,12 +1106,11 @@ void OmpStructureChecker::CheckAtomicRead(
// of the following forms:
// v = x
// v => x
- auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
auto &block{std::get<parser::Block>(x.t)};
// Read cannot be conditional or have a capture statement.
if (x.IsCompare() || x.IsCapture()) {
- context_.Say(dirSpec.source,
+ context_.Say(x.BeginDir().source,
"ATOMIC READ cannot have COMPARE or CAPTURE clauses"_err_en_US);
return;
}
@@ -1141,12 +1141,11 @@ void OmpStructureChecker::CheckAtomicRead(
void OmpStructureChecker::CheckAtomicWrite(
const parser::OpenMPAtomicConstruct &x) {
- auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
auto &block{std::get<parser::Block>(x.t)};
// Write cannot be conditional or have a capture statement.
if (x.IsCompare() || x.IsCapture()) {
- context_.Say(dirSpec.source,
+ context_.Say(x.BeginDir().source,
"ATOMIC WRITE cannot have COMPARE or CAPTURE clauses"_err_en_US);
return;
}
@@ -1234,7 +1233,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPAtomicConstruct &x) {
}
}};
- auto &dirSpec{std::get<parser::OmpDirectiveSpecification>(x.t)};
+ const parser::OmpDirectiveSpecification &dirSpec{x.BeginDir()};
auto &dir{std::get<parser::OmpDirectiveName>(dirSpec.t)};
PushContextAndClauseSets(dir.source, llvm::omp::Directive::OMPD_atomic);
llvm::omp::Clause kind{x.GetKind()};