aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/LLVMContext.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-15 21:00:46 +0000
committerOwen Anderson <resistor@mac.com>2009-07-15 21:00:46 +0000
commit23c8046a84af0cef7bdeeb2af3313821d274b974 (patch)
tree800a524bcdf2d30953e9871fe19c9fdfd073c550 /lib/VMCore/LLVMContext.cpp
parentf1459cf1f289a6a3454ed7005ba404dd94b4571e (diff)
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
Diffstat (limited to 'lib/VMCore/LLVMContext.cpp')
-rw-r--r--lib/VMCore/LLVMContext.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp
index 90230f0420..e359ae33df 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<Constant*>& V,
- bool Packed) {
- return ConstantStruct::get(V, Packed);
+ bool packed) {
+ std::vector<const Type*> 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<Constant*>(Vals, Vals+NumVals), Packed);
}