[Mlir-commits] [mlir] 07548b8 - [PatternRewriter] Disable copy/assign operators.

Chris Lattner llvmlistbot at llvm.org
Mon Aug 2 10:26:39 PDT 2021


Author: Chris Lattner
Date: 2021-08-02T10:26:33-07:00
New Revision: 07548b83247e5c266e209ac4cdc2ab7a3231155d

URL: https://github.com/llvm/llvm-project/commit/07548b83247e5c266e209ac4cdc2ab7a3231155d
DIFF: https://github.com/llvm/llvm-project/commit/07548b83247e5c266e209ac4cdc2ab7a3231155d.diff

LOG: [PatternRewriter] Disable copy/assign operators.

We had a [bad bug](https://github.com/llvm/circt/commit/69655864ee38167016506e9dae2eb1eb43dc3ba5) over in CIRCT
caused by accidentally passing around PatternRewriter
by value.  There is no reason to support copy/assignment
of the pattern rewriter, so disable it.

Differential Revision: https://reviews.llvm.org/D107232

Added: 
    

Modified: 
    mlir/include/mlir/IR/PatternMatch.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h
index 15f96535f2d78..ba8d1455528cf 100644
--- a/mlir/include/mlir/IR/PatternMatch.h
+++ b/mlir/include/mlir/IR/PatternMatch.h
@@ -836,6 +836,9 @@ class RewriterBase : public OpBuilder, public OpBuilder::Listener {
   }
 
 private:
+  void operator=(const RewriterBase &) = delete;
+  RewriterBase(const RewriterBase &) = delete;
+
   /// 'op' and 'newOp' are known to have the same number of results, replace the
   /// uses of op with uses of newOp.
   void replaceOpWithResultsOfAnotherOp(Operation *op, Operation *newOp);


        


More information about the Mlir-commits mailing list