Change Block::getParent() to be a const function. This is only necessary because...
authorChristian Sigg <csigg@google.com>
Mon, 7 Oct 2019 17:02:44 +0000 (10:02 -0700)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 7 Oct 2019 17:03:28 +0000 (10:03 -0700)
PiperOrigin-RevId: 273316153

mlir/include/mlir/IR/Block.h
mlir/include/mlir/IR/Operation.h
mlir/lib/IR/Block.cpp

index 37ce002..c7770a1 100644 (file)
@@ -93,8 +93,12 @@ public:
       operations.pop_back();
   }
 
-  /// Blocks are maintained in a Region.
-  Region *getParent();
+  /// Provide a 'getParent' method for ilist_node_with_parent methods.
+  /// We mark it as a const function because ilist_node_with_parent specifically
+  /// requires a 'getParent() const' method. Once ilist_node removes this
+  /// constraint, we should drop the const to fit the rest of the MLIR const
+  /// model.
+  Region *getParent() const;
 
   /// Returns the closest surrounding operation that contains this block.
   Operation *getParentOp();
index e7f22ff..5444d6c 100644 (file)
@@ -563,7 +563,7 @@ private:
   }
 
   /// Provide a 'getParent' method for ilist_node_with_parent methods.
-  /// We mark it as const function because ilist_node_with_parent specifically
+  /// We mark it as const function because ilist_node_with_parent specifically
   /// requires a 'getParent() const' method. Once ilist_node removes this
   /// constraint, we should drop the const to fit the rest of the MLIR const
   /// model.
index 741837f..858fcc9 100644 (file)
@@ -41,7 +41,9 @@ Block::~Block() {
   llvm::DeleteContainerPointers(arguments);
 }
 
-Region *Block::getParent() { return parentValidInstOrderPair.getPointer(); }
+Region *Block::getParent() const {
+  return parentValidInstOrderPair.getPointer();
+}
 
 /// Returns the closest surrounding operation that contains this block or
 /// nullptr if this block is unlinked.