[flang-commits] [flang] [flang][OpenMP] Change return type of Enter from bool to void, NFC (PR #198299)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Mon May 18 06:37:17 PDT 2026
https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/198299
Some of the overloads of the "Enter" functions in OmpStructureChecker are declared with bool as the return type. The actual return type of Enter is void, and if there is any value returned, it will be ignored.
Change the return type to void for the several functions that return bool.
>From d99856ca5560da29e131c50fcca2ba88141ac163 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Mon, 18 May 2026 08:32:14 -0500
Subject: [PATCH] [flang][OpenMP] Change return type of Enter from bool to
void, NFC
Some of the overloads of the "Enter" functions in OmpStructureChecker
are declared with bool as the return type. The actual return type of
Enter is void, and if there is any value returned, it will be ignored.
Change the return type to void for the several functions that return
bool.
---
flang/lib/Semantics/check-omp-structure.cpp | 33 +++++++--------------
flang/lib/Semantics/check-omp-structure.h | 22 +++++++-------
2 files changed, 22 insertions(+), 33 deletions(-)
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 505643fa617f1..512de68d63e7e 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -73,7 +73,7 @@ void OmpStructureChecker::Enter(const parser::ProgramUnit &) { //
ClearLabels();
}
-bool OmpStructureChecker::Enter(const parser::MainProgram &x) {
+void OmpStructureChecker::Enter(const parser::MainProgram &x) {
using StatementProgramStmt = parser::Statement<parser::ProgramStmt>;
if (auto &stmt{std::get<std::optional<StatementProgramStmt>>(x.t)}) {
scopeStack_.push_back(stmt->statement.v.symbol->scope());
@@ -86,14 +86,13 @@ bool OmpStructureChecker::Enter(const parser::MainProgram &x) {
}
}
}
- return true;
}
void OmpStructureChecker::Leave(const parser::MainProgram &x) {
scopeStack_.pop_back();
}
-bool OmpStructureChecker::Enter(const parser::BlockData &x) {
+void OmpStructureChecker::Enter(const parser::BlockData &x) {
// The BLOCK DATA name is optional, so we need to look for the
// corresponding scope in the global scope.
auto &stmt{std::get<parser::Statement<parser::BlockDataStmt>>(x.t)};
@@ -109,29 +108,26 @@ bool OmpStructureChecker::Enter(const parser::BlockData &x) {
}
}
}
- return true;
}
void OmpStructureChecker::Leave(const parser::BlockData &x) {
scopeStack_.pop_back();
}
-bool OmpStructureChecker::Enter(const parser::Module &x) {
+void OmpStructureChecker::Enter(const parser::Module &x) {
auto &stmt{std::get<parser::Statement<parser::ModuleStmt>>(x.t)};
const Symbol *sym{stmt.statement.v.symbol};
scopeStack_.push_back(sym->scope());
- return true;
}
void OmpStructureChecker::Leave(const parser::Module &x) {
scopeStack_.pop_back();
}
-bool OmpStructureChecker::Enter(const parser::Submodule &x) {
+void OmpStructureChecker::Enter(const parser::Submodule &x) {
auto &stmt{std::get<parser::Statement<parser::SubmoduleStmt>>(x.t)};
const Symbol *sym{std::get<parser::Name>(stmt.statement.t).symbol};
scopeStack_.push_back(sym->scope());
- return true;
}
void OmpStructureChecker::Leave(const parser::Submodule &x) {
@@ -140,43 +136,36 @@ void OmpStructureChecker::Leave(const parser::Submodule &x) {
// Function/subroutine subprogram nodes don't appear in INTERFACEs, but
// the subprogram/end statements do.
-bool OmpStructureChecker::Enter(const parser::SubroutineStmt &x) {
+void OmpStructureChecker::Enter(const parser::SubroutineStmt &x) {
const Symbol *sym{std::get<parser::Name>(x.t).symbol};
scopeStack_.push_back(sym->scope());
- return true;
}
-bool OmpStructureChecker::Enter(const parser::EndSubroutineStmt &x) {
+void OmpStructureChecker::Enter(const parser::EndSubroutineStmt &x) {
scopeStack_.pop_back();
- return true;
}
-bool OmpStructureChecker::Enter(const parser::FunctionStmt &x) {
+void OmpStructureChecker::Enter(const parser::FunctionStmt &x) {
const Symbol *sym{std::get<parser::Name>(x.t).symbol};
scopeStack_.push_back(sym->scope());
- return true;
}
-bool OmpStructureChecker::Enter(const parser::EndFunctionStmt &x) {
+void OmpStructureChecker::Enter(const parser::EndFunctionStmt &x) {
scopeStack_.pop_back();
- return true;
}
-bool OmpStructureChecker::Enter(const parser::MpSubprogramStmt &x) {
+void OmpStructureChecker::Enter(const parser::MpSubprogramStmt &x) {
const Symbol *sym{x.v.symbol};
scopeStack_.push_back(sym->scope());
- return true;
}
-bool OmpStructureChecker::Enter(const parser::EndMpSubprogramStmt &x) {
+void OmpStructureChecker::Enter(const parser::EndMpSubprogramStmt &x) {
scopeStack_.pop_back();
- return true;
}
-bool OmpStructureChecker::Enter(const parser::BlockConstruct &x) {
+void OmpStructureChecker::Enter(const parser::BlockConstruct &x) {
auto &endBlockStmt{std::get<parser::Statement<parser::EndBlockStmt>>(x.t)};
scopeStack_.push_back(&context_.FindScope(endBlockStmt.source));
- return true;
}
void OmpStructureChecker::Leave(const parser::BlockConstruct &x) {
diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h
index ac3332f9a52ba..b3f58335027de 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -70,21 +70,21 @@ class OmpStructureChecker : public OmpStructureCheckerBase {
OmpStructureChecker(SemanticsContext &context);
void Enter(const parser::ProgramUnit &);
- bool Enter(const parser::MainProgram &);
+ void Enter(const parser::MainProgram &);
void Leave(const parser::MainProgram &);
- bool Enter(const parser::BlockData &);
+ void Enter(const parser::BlockData &);
void Leave(const parser::BlockData &);
- bool Enter(const parser::Module &);
+ void Enter(const parser::Module &);
void Leave(const parser::Module &);
- bool Enter(const parser::Submodule &);
+ void Enter(const parser::Submodule &);
void Leave(const parser::Submodule &);
- bool Enter(const parser::SubroutineStmt &);
- bool Enter(const parser::EndSubroutineStmt &);
- bool Enter(const parser::FunctionStmt &);
- bool Enter(const parser::EndFunctionStmt &);
- bool Enter(const parser::MpSubprogramStmt &);
- bool Enter(const parser::EndMpSubprogramStmt &);
- bool Enter(const parser::BlockConstruct &);
+ void Enter(const parser::SubroutineStmt &);
+ void Enter(const parser::EndSubroutineStmt &);
+ void Enter(const parser::FunctionStmt &);
+ void Enter(const parser::EndFunctionStmt &);
+ void Enter(const parser::MpSubprogramStmt &);
+ void Enter(const parser::EndMpSubprogramStmt &);
+ void Enter(const parser::BlockConstruct &);
void Leave(const parser::BlockConstruct &);
void Enter(const parser::InternalSubprogram &);
void Enter(const parser::ModuleSubprogram &);
More information about the flang-commits
mailing list