From: Owen Anderson Date: Wed, 15 Jul 2009 21:00:46 +0000 (+0000) Subject: Move the ConstantStruct factory methods over to LLVMContext. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=23c8046a84af0cef7bdeeb2af3313821d274b974;p=oota-llvm.git Move the ConstantStruct factory methods over to LLVMContext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75830 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index 27e225bc379..12777025c6d 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -379,12 +379,6 @@ public: /// get() - Static factory methods - Return objects of the specified value /// static Constant *get(const StructType *T, const std::vector &V); - static Constant *get(const std::vector &V, bool Packed = false); - static Constant *get(Constant*const* Vals, unsigned NumVals, - bool Packed = false) { - // FIXME: make this the primary ctor method. - return get(std::vector(Vals, Vals+NumVals), Packed); - } /// Transparently provide more efficient getOperand methods. DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant); diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 5c7c288ce9e..b123f85931b 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1371,14 +1371,6 @@ Constant *ConstantStruct::get(const StructType *Ty, return ConstantAggregateZero::get(Ty); } -Constant *ConstantStruct::get(const std::vector &V, bool packed) { - std::vector StructEls; - StructEls.reserve(V.size()); - for (unsigned i = 0, e = V.size(); i != e; ++i) - StructEls.push_back(V[i]->getType()); - return get(StructType::get(StructEls, packed), V); -} - // destroyConstant - Remove the constant from the constant table... // void ConstantStruct::destroyConstant() { diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index 90230f04204..e359ae33df8 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/lib/VMCore/LLVMContext.cpp @@ -146,13 +146,18 @@ Constant* LLVMContext::getConstantStruct(const StructType* T, } Constant* LLVMContext::getConstantStruct(const std::vector& V, - bool Packed) { - return ConstantStruct::get(V, Packed); + bool packed) { + std::vector StructEls; + StructEls.reserve(V.size()); + for (unsigned i = 0, e = V.size(); i != e; ++i) + StructEls.push_back(V[i]->getType()); + return getConstantStruct(getStructType(StructEls, packed), V); } Constant* LLVMContext::getConstantStruct(Constant* const *Vals, unsigned NumVals, bool Packed) { - return ConstantStruct::get(Vals, NumVals, Packed); + // FIXME: make this the primary ctor method. + return getConstantStruct(std::vector(Vals, Vals+NumVals), Packed); }