Add classof implementations for User
authorChris Lattner <sabre@nondot.org>
Sat, 13 Oct 2001 06:18:05 +0000 (06:18 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 13 Oct 2001 06:18:05 +0000 (06:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@739 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/User.h

index 535dd1e88af93685a3f16c3c3fa07b4c7dd3ad19..6b1ece4dc2f9aa1a76c43ce17f9b782e2c73e011 100644 (file)
@@ -64,6 +64,14 @@ public:
   //
   void replaceUsesOfWith(Value *From, Value *To);
 
+  // Methods for support type inquiry through isa, cast, and dyn_cast:
+  static inline bool classof(const User *) { return true; }
+  static inline bool classof(const Value *V) {
+    return V->getValueType() == Value::GlobalVariableVal ||
+           V->getValueType() == Value::ConstantVal ||
+           V->getValueType() == Value::InstructionVal;
+  }
+
   // addOperand - This is a special purpose API that should not be used in most
   // cases.  It adds an empty (null) operand to the instruction specified.  This
   // is currently used by the back end as part of the "lowering" process... most