aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-13 06:18:05 +0000
committerChris Lattner <sabre@nondot.org>2001-10-13 06:18:05 +0000
commit26e129e64f2f6aa77a541ffd9101b2da38fc089e (patch)
tree9f2bd4c8efeb0e6d9d77880664d6a13f5bd2ecfe
parent067238d5d9ba19ad235f55fe4349112b39385fae (diff)
Add classof implementations for User
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@739 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/User.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/User.h b/include/llvm/User.h
index 535dd1e88a..6b1ece4dc2 100644
--- a/include/llvm/User.h
+++ b/include/llvm/User.h
@@ -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