summaryrefslogtreecommitdiff
path: root/include/llvm/Constant.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-04 02:43:00 +0000
committerChris Lattner <sabre@nondot.org>2004-08-04 02:43:00 +0000
commit13b03586d2911fb6ba324c1fca94c2e2a23444be (patch)
tree92d254bff40f8262673722925a7baf4bf73ee2c2 /include/llvm/Constant.h
parent0f42ba67771627453187e44fea935d6bab7a8152 (diff)
downloadllvm-13b03586d2911fb6ba324c1fca94c2e2a23444be.tar.gz
llvm-13b03586d2911fb6ba324c1fca94c2e2a23444be.tar.bz2
llvm-13b03586d2911fb6ba324c1fca94c2e2a23444be.tar.xz
Now that ConstantPointerRef is gone, it is the case that all operands of constants
are themselves constants. This should allow us to reduce a significant amount of casting in the sourcebase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constant.h')
-rw-r--r--include/llvm/Constant.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h
index fda1005ef1..c765503736 100644
--- a/include/llvm/Constant.h
+++ b/include/llvm/Constant.h
@@ -40,6 +40,18 @@ public:
virtual void print(std::ostream &O) const;
+ // Specialize get/setOperand for Constant's as their operands are always
+ // constants as well.
+ Constant *getOperand(unsigned i) {
+ return static_cast<Constant*>(User::getOperand(i));
+ }
+ const Constant *getOperand(unsigned i) const {
+ return static_cast<const Constant*>(User::getOperand(i));
+ }
+ void setOperand(unsigned i, Constant *C) {
+ User::setOperand(i, C);
+ }
+
/// destroyConstant - Called if some element of this constant is no longer
/// valid. At this point only other constants may be on the use_list for this
/// constant. Any constants on our Use list must also be destroy'd. The