Change getParent() to be a const function. This is only necessary because ilist_n...
authorYoulong Cheng <ylc@google.com>
Tue, 21 May 2019 06:10:10 +0000 (23:10 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 02:53:22 +0000 (19:53 -0700)
--

PiperOrigin-RevId: 249193257

mlir/include/mlir/IR/Operation.h

index 232c18c..107bfb8 100644 (file)
@@ -434,8 +434,12 @@ private:
     return *getTrailingObjects<detail::OperandStorage>();
   }
 
-  // Provide a 'getParent' method for ilist_node_with_parent methods.
-  Block *getParent() { return getBlock(); }
+  /// Provide a 'getParent' method for ilist_node_with_parent methods.
+  /// 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.
+  Block *getParent() const { return block; }
 
   /// The operation block that containts this operation.
   Block *block = nullptr;