From b6130afb0e64d763d8e1e20b1446d5cc80e87ae8 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Thu, 30 Apr 2026 10:43:23 -0500 Subject: [PATCH] =?UTF-8?q?[flang][OpenMP]=20Remove=20deferredNonVariables?= =?UTF-8?q?=5F=20from=20OmpStructureChecker=E2=80=A6=20(#195100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …, 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 7bff7de2f8fb..40f81bd3abcd 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 e75bb5da847a..142602c1f111 100644 --- a/flang/lib/Semantics/check-omp-structure.h +++ b/flang/lib/Semantics/check-omp-structure.h @@ -420,7 +420,6 @@ private: 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