1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Move the ConstantStruct factory methods over to LLVMContext.

llvm-svn: 75830
This commit is contained in:
Owen Anderson 2009-07-15 21:00:46 +00:00
parent 07f75f2e42
commit 0171f6bc65
3 changed files with 8 additions and 17 deletions

View File

@ -379,12 +379,6 @@ public:
/// get() - Static factory methods - Return objects of the specified value
///
static Constant *get(const StructType *T, const std::vector<Constant*> &V);
static Constant *get(const std::vector<Constant*> &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<Constant*>(Vals, Vals+NumVals), Packed);
}
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);

View File

@ -1371,14 +1371,6 @@ Constant *ConstantStruct::get(const StructType *Ty,
return ConstantAggregateZero::get(Ty);
}
Constant *ConstantStruct::get(const std::vector<Constant*> &V, 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 get(StructType::get(StructEls, packed), V);
}
// destroyConstant - Remove the constant from the constant table...
//
void ConstantStruct::destroyConstant() {

View File

@ -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);
}