[flang-commits] [flang] 161d002 - [flang] Silence warnings from hermetic module files (#128763)

via flang-commits flang-commits at lists.llvm.org
Thu Feb 27 14:29:39 PST 2025


Author: Peter Klausler
Date: 2025-02-27T14:29:35-08:00
New Revision: 161d002a0949046131ecaa6574ddfece5cfd225e

URL: https://github.com/llvm/llvm-project/commit/161d002a0949046131ecaa6574ddfece5cfd225e
DIFF: https://github.com/llvm/llvm-project/commit/161d002a0949046131ecaa6574ddfece5cfd225e.diff

LOG: [flang] Silence warnings from hermetic module files (#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.

Added: 
    

Modified: 
    flang/lib/Semantics/mod-file.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index 82c43d96bea44..1dfd9c35b3f43 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -1546,6 +1546,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