Add some methods to make type safety a bit easier
authorChris Lattner <sabre@nondot.org>
Wed, 14 May 2003 17:49:52 +0000 (17:49 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 14 May 2003 17:49:52 +0000 (17:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6198 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Constants.h

index 396a5ca0930dd7038169a67c94bb222374fb1ecc..7c0a00506af000ab5e1c4091039c67f3aac6986a 100644 (file)
@@ -506,6 +506,15 @@ public:
   virtual void destroyConstant();
   virtual void replaceUsesOfWithOnConstant(Value *From, Value *To);
     
+  /// Override methods to provide more type information...
+  inline Constant *getOperand(unsigned i) { 
+    return cast<Constant>(User::getOperand(i));
+  }
+  inline Constant *getOperand(unsigned i) const {
+    return const_cast<Constant*>(cast<Constant>(User::getOperand(i)));
+  }
+  
+
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantExpr *) { return true; }
   static inline bool classof(const Constant *CPV) {