[flang-commits] [flang] [flang] Silence warnings from hermetic module files (PR #128763)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Tue Feb 25 11:07:00 PST 2025
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/128763
Modules read from module files must have their symbols tagged with the ModFile flag to suppress all warnings messages that might be emitted for their contents. (Actionable warnings will have been emitted when the modules were originally compiled, so we don't want to repeat them later when the modules are USE'd.) The module symbols of the additional modules in hermetic module files were not being tagged with that flag; fix.
>From 6b4b66cd7a067577d189312fd90ef9d2ea714a83 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Tue, 25 Feb 2025 11:03:03 -0800
Subject: [PATCH] [flang] Silence warnings from hermetic module files
Modules read from module files must have their symbols tagged with
the ModFile flag to suppress all warnings messages that might be
emitted for their contents. (Actionable warnings will have been
emitted when the modules were originally compiled, so we don't want
to repeat them later when the modules are USE'd.) The module symbols
of the additional modules in hermetic module files were not being
tagged with that flag; fix.
---
flang/lib/Semantics/mod-file.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index bef934beaacfa..c208aae423579 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -1563,6 +1563,10 @@ Scope *ModFileReader::Read(SourceName name, std::optional<bool> isIntrinsic,
Scope &hermeticScope{topScope.MakeScope(Scope::Kind::Global)};
context_.set_currentHermeticModuleFileScope(&hermeticScope);
ResolveNames(context_, hermeticModules, hermeticScope);
+ for (auto &[_, ref] : hermeticScope) {
+ CHECK(ref->has<ModuleDetails>());
+ ref->set(Symbol::Flag::ModFile);
+ }
}
GetModuleDependences(context_.moduleDependences(), sourceFile->content());
ResolveNames(context_, parseTree, topScope);
More information about the flang-commits
mailing list