[MachineBasicBlock] Use the const_cast(this) trick to reduce duplication
[oota-llvm.git] / include / llvm / CodeGen / MachineBasicBlock.h
index 357aef0ee60da8d4f422bd9fb85d3e906d260211..a13b78870d4daf8c71327feff84a7c589dd6f0d3 100644 (file)
@@ -461,7 +461,9 @@ public:
   /// instruction of this basic block. If a terminator does not exist,
   /// it returns end()
   iterator getFirstTerminator();
-  const_iterator getFirstTerminator() const;
+  const_iterator getFirstTerminator() const {
+    return const_cast<MachineBasicBlock *>(this)->getFirstTerminator();
+  }
 
   /// getFirstInstrTerminator - Same getFirstTerminator but it ignores bundles
   /// and return an instr_iterator instead.
@@ -470,7 +472,9 @@ public:
   /// getLastNonDebugInstr - returns an iterator to the last non-debug
   /// instruction in the basic block, or end()
   iterator getLastNonDebugInstr();
-  const_iterator getLastNonDebugInstr() const;
+  const_iterator getLastNonDebugInstr() const {
+    return const_cast<MachineBasicBlock *>(this)->getLastNonDebugInstr();
+  }
 
   /// SplitCriticalEdge - Split the critical edge from this block to the
   /// given successor block, and return the newly created block, or null