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.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/flang/lib/Semantics/check-omp-atomic.cpp b/flang/lib/Semantics/check-omp-atomic.cpp
index 333fad0..eca50c1 100644
--- a/flang/lib/Semantics/check-omp-atomic.cpp
+++ b/flang/lib/Semantics/check-omp-atomic.cpp
@@ -1106,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;
}
@@ -1142,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;
}
@@ -1235,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()};