[flang-commits] [flang] 13b808b - [Flang][Tool][bbc] Emit module wrapper in addition to body

Andrew Gozillon via flang-commits flang-commits at lists.llvm.org
Wed Mar 1 12:41:25 PST 2023


Author: Andrew Gozillon
Date: 2023-03-01T14:41:02-06:00
New Revision: 13b808bda93ec7271d2e5690f0d1d467e0f59f17

URL: https://github.com/llvm/llvm-project/commit/13b808bda93ec7271d2e5690f0d1d467e0f59f17
DIFF: https://github.com/llvm/llvm-project/commit/13b808bda93ec7271d2e5690f0d1d467e0f59f17.diff

LOG: [Flang][Tool][bbc] Emit module wrapper in addition to body

This change seeks to emit the full module from the bbc tool and
not just the body. This change currently does not break existing tests
when running check-(mlir, flang, all). This stops the discarding of
any attributes that may be applied to the Module during
compilation.

Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D144869

Added: 
    

Modified: 
    flang/tools/bbc/bbc.cpp

Removed: 
    


################################################################################
diff  --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index 9a39c5b2cea4c..af2e162bf4563 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -142,11 +142,10 @@ static llvm::cl::opt<bool> useHLFIR("hlfir",
 
 using ProgramName = std::string;
 
-// Print the module without the "module { ... }" wrapper.
+// Print the module with the "module { ... }" wrapper, preventing
+// information loss from attribute information appended to the module
 static void printModule(mlir::ModuleOp mlirModule, llvm::raw_ostream &out) {
-  for (auto &op : *mlirModule.getBody())
-    out << op << '\n';
-  out << '\n';
+  out << mlirModule << '\n';
 }
 
 static void registerAllPasses() {


        


More information about the flang-commits mailing list