summaryrefslogtreecommitdiff
path: root/include/llvm/Constant.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-25 06:16:32 +0000
committerChris Lattner <sabre@nondot.org>2012-01-25 06:16:32 +0000
commit3d5ed2250e78c3e849232398cb550238155dbb72 (patch)
tree1e1ec9d242f369169792b6d3245bd8a4fef4ad94 /include/llvm/Constant.h
parent4ca829e89567f002fc74eb0e3e532a7c7662e031 (diff)
downloadllvm-3d5ed2250e78c3e849232398cb550238155dbb72.tar.gz
llvm-3d5ed2250e78c3e849232398cb550238155dbb72.tar.bz2
llvm-3d5ed2250e78c3e849232398cb550238155dbb72.tar.xz
constify some methods and add a new Constant::getAggregateElement
helper method for the common operation of extracting an element out of a constant aggregate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148931 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constant.h')
-rw-r--r--include/llvm/Constant.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h
index 3ce8d2c243..f7d4dd2d32 100644
--- a/include/llvm/Constant.h
+++ b/include/llvm/Constant.h
@@ -97,6 +97,13 @@ public:
/// constant exprs and other cases we can't handle, we return an empty vector.
void getVectorElements(SmallVectorImpl<Constant*> &Elts) const;
+ /// getAggregateElement - For aggregates (struct/array/vector) return the
+ /// constant that corresponds to the specified element if possible, or null if
+ /// not. This can return null if the element index is a ConstantExpr, or if
+ /// 'this' is a constant expr.
+ Constant *getAggregateElement(unsigned Elt) const;
+ Constant *getAggregateElement(Constant *Elt) const;
+
/// 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