[Mlir-commits] [mlir] 7cfb7a6 - [mlir] Make Type::print and Type::dump const

Fangrui Song llvmlistbot at llvm.org
Wed Jun 16 15:31:26 PDT 2021


Author: Robert David
Date: 2021-06-16T15:31:20-07:00
New Revision: 7cfb7a67c57dfb40518a0873137a21b0a8def503

URL: https://github.com/llvm/llvm-project/commit/7cfb7a67c57dfb40518a0873137a21b0a8def503
DIFF: https://github.com/llvm/llvm-project/commit/7cfb7a67c57dfb40518a0873137a21b0a8def503.diff

LOG: [mlir] Make Type::print and Type::dump const

Added: 
    

Modified: 
    mlir/include/mlir/IR/Types.h
    mlir/lib/IR/AsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Types.h b/mlir/include/mlir/IR/Types.h
index 9aeff140d164e..3b714ab808e6e 100644
--- a/mlir/include/mlir/IR/Types.h
+++ b/mlir/include/mlir/IR/Types.h
@@ -156,8 +156,8 @@ class Type {
   bool isIntOrIndexOrFloat() const;
 
   /// Print the current type.
-  void print(raw_ostream &os);
-  void dump();
+  void print(raw_ostream &os) const;
+  void dump() const;
 
   friend ::llvm::hash_code hash_value(Type arg);
 

diff  --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp
index 7936964ea3950..7bc9bec2f927a 100644
--- a/mlir/lib/IR/AsmPrinter.cpp
+++ b/mlir/lib/IR/AsmPrinter.cpp
@@ -2697,9 +2697,9 @@ void Attribute::dump() const {
   llvm::errs() << "\n";
 }
 
-void Type::print(raw_ostream &os) { ModulePrinter(os).printType(*this); }
+void Type::print(raw_ostream &os) const { ModulePrinter(os).printType(*this); }
 
-void Type::dump() { print(llvm::errs()); }
+void Type::dump() const { print(llvm::errs()); }
 
 void AffineMap::dump() const {
   print(llvm::errs());


        


More information about the Mlir-commits mailing list