aboutsummaryrefslogtreecommitdiff
path: root/llvm/include
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
commit26dc86a8bd71b8c113eb9c472370e3856e7abc06 (patch)
tree0a7e3d4058ed9ac64ebae45a131eae1de33eaf2c /llvm/include
parentda340a9bd50bb4a0254e48f4338f977f96da5b73 (diff)
downloadllvm-26dc86a8bd71b8c113eb9c472370e3856e7abc06.zip
llvm-26dc86a8bd71b8c113eb9c472370e3856e7abc06.tar.gz
llvm-26dc86a8bd71b8c113eb9c472370e3856e7abc06.tar.bz2
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. llvm-svn: 15459
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Constant.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/Constant.h b/llvm/include/llvm/Constant.h
index fda1005..c765503 100644
--- a/llvm/include/llvm/Constant.h
+++ b/llvm/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