diff --git a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h --- a/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h +++ b/mlir/include/mlir/Dialect/MemRef/IR/MemRef.h @@ -24,7 +24,7 @@ class Location; class OpBuilder; -raw_ostream &operator<<(raw_ostream &os, Range &range); +raw_ostream &operator<<(raw_ostream &os, const Range &range); /// Return the list of Range (i.e. offset, size, stride). Each Range /// entry contains either the dynamic value or a ConstantIndexOp constructed diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -109,11 +109,11 @@ MLIRContext *getContext() { return getOperation()->getContext(); } /// Print the operation to the given stream. - void print(raw_ostream &os, OpPrintingFlags flags = llvm::None) { + void print(raw_ostream &os, OpPrintingFlags flags = llvm::None) const { state->print(os, flags); } void print(raw_ostream &os, AsmState &asmState, - OpPrintingFlags flags = llvm::None) { + OpPrintingFlags flags = llvm::None) const { state->print(os, asmState, flags); } @@ -222,7 +222,7 @@ } /// Allow printing to a stream. -inline raw_ostream &operator<<(raw_ostream &os, OpState &op) { +inline raw_ostream &operator<<(raw_ostream &os, const OpState &op) { op.print(os, OpPrintingFlags().useLocalScope()); return os; } @@ -1647,9 +1647,9 @@ llvm::is_detected; /// Trait to check if T provides a general 'fold' method. template - using has_fold = decltype(std::declval().fold( - std::declval>(), - std::declval &>())); + using has_fold = decltype( + std::declval().fold(std::declval>(), + std::declval &>())); template using detect_has_fold = llvm::is_detected; /// Trait to check if T provides a 'print' method. diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h --- a/mlir/include/mlir/IR/Operation.h +++ b/mlir/include/mlir/IR/Operation.h @@ -117,7 +117,8 @@ Operation *getParentOp() { return block ? block->getParentOp() : nullptr; } /// Return the closest surrounding parent operation that is of type 'OpTy'. - template OpTy getParentOfType() { + template + OpTy getParentOfType() { auto *op = this; while ((op = op->getParentOp())) if (auto parentOp = dyn_cast(op)) @@ -331,10 +332,12 @@ Attribute getAttr(Identifier name) { return attrs.get(name); } Attribute getAttr(StringRef name) { return attrs.get(name); } - template AttrClass getAttrOfType(Identifier name) { + template + AttrClass getAttrOfType(Identifier name) { return getAttr(name).dyn_cast_or_null(); } - template AttrClass getAttrOfType(StringRef name) { + template + AttrClass getAttrOfType(StringRef name) { return getAttr(name).dyn_cast_or_null(); } @@ -473,7 +476,8 @@ /// Returns true if the operation was registered with a particular trait, e.g. /// hasTrait(). - template