[flang-commits] [flang] [flang][OpenMP] Remove deferredNonVariables_ from OmpStructureChecker… (PR #195100)
via flang-commits
flang-commits at lists.llvm.org
Thu Apr 30 07:56:45 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
…, 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.
---
Full diff: https://github.com/llvm/llvm-project/pull/195100.diff
2 Files Affected:
- (modified) flang/lib/Semantics/check-omp-structure.cpp (+2-6)
- (modified) flang/lib/Semantics/check-omp-structure.h (-1)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/195100
More information about the flang-commits
mailing list