[flang-commits] [flang] [flang][OpenMP] Remove deferredNonVariables_ from OmpStructureChecker… (PR #195100)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Thu Apr 30 07:56:04 PDT 2026
https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/195100
…, NFC
It was created to defer error messages about invalid argument types until the end of the analysis of the construct. That is not necessary since diagnostic messages are emitted in the order corresponding to their location in the source, not the order they were generated.
>From ca96b67b4c2a6b74c3419cfecd1efc23faf2075a Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Thu, 30 Apr 2026 09:49:42 -0500
Subject: [PATCH] [flang][OpenMP] Remove deferredNonVariables_ from
OmpStructureChecker, NFC
It was created to defer error messages about invalid argument types until
the end of the analysis of the construct. That is not necessary since
diagnostic messages are emitted in the order corresponding to their
location in the source, not the order they were generated.
---
flang/lib/Semantics/check-omp-structure.cpp | 8 ++------
flang/lib/Semantics/check-omp-structure.h | 1 -
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 7bff7de2f8fbf..40f81bd3abcdc 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -946,11 +946,6 @@ void OmpStructureChecker::Enter(const parser::OpenMPConstruct &x) {
}
void OmpStructureChecker::Leave(const parser::OpenMPConstruct &x) {
- for (const auto &[sym, source] : deferredNonVariables_) {
- context_.SayWithDecl(
- *sym, source, "'%s' must be a variable"_err_en_US, sym->name());
- }
- deferredNonVariables_.clear();
if (GetOmpDirectiveName(x).v != llvm::omp::Directive::OMPD_section) {
dirStack_.pop_back();
}
@@ -3692,7 +3687,8 @@ void OmpStructureChecker::Enter(const parser::OmpClause &x) {
for (const auto &[symbol, source] : symbols) {
if (!IsVariableListItem(*symbol) &&
!(IsNamedConstant(*symbol) && SharedOrFirstprivate)) {
- deferredNonVariables_.insert({symbol, source});
+ context_.SayWithDecl(*symbol, source,
+ "'%s' must be a variable"_err_en_US, symbol->name());
}
}
}
diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h
index e75bb5da847a9..142602c1f1118 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -420,7 +420,6 @@ class OmpStructureChecker : public OmpStructureCheckerBase {
int allocateDirectiveLevel_{0};
parser::CharBlock visitedAtomicSource_;
- SymbolSourceMap deferredNonVariables_;
// Stack of nested DO loops and OpenMP constructs.
// This is used to verify DO loop nest for DOACROSS, and branches into
More information about the flang-commits
mailing list