[flang][OpenMP] Remove deferredNonVariables_ from OmpStructureChecker… (#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.
This commit is contained in:
Krzysztof Parzyszek
2026-04-30 10:43:23 -05:00
committed by GitHub
parent 9dcb6f709b
commit b6130afb0e
2 changed files with 2 additions and 7 deletions

View File

@@ -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());
}
}
}

View File

@@ -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