mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-24 12:55:45 +00:00
Add an END_WITH_NULL accessor for ConstantStruct.
llvm-svn: 126714
This commit is contained in:
parent
77d6f9b20e
commit
753b7ce425
@ -425,6 +425,8 @@ public:
|
||||
const std::vector<Constant*> &V, bool Packed);
|
||||
static Constant *get(LLVMContext &Context,
|
||||
Constant *const *Vals, unsigned NumVals, bool Packed);
|
||||
static Constant *get(LLVMContext &Context, bool Packed,
|
||||
Constant * Val, ...) END_WITH_NULL;
|
||||
|
||||
/// Transparently provide more efficient getOperand methods.
|
||||
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <cstdarg>
|
||||
using namespace llvm;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
@ -596,8 +597,6 @@ Constant *ConstantArray::get(LLVMContext &Context, StringRef Str,
|
||||
return get(ATy, ElementVals);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ConstantStruct::ConstantStruct(const StructType *T,
|
||||
const std::vector<Constant*> &V)
|
||||
: Constant(T, ConstantStructVal,
|
||||
@ -644,6 +643,18 @@ Constant *ConstantStruct::get(LLVMContext &Context,
|
||||
return get(Context, std::vector<Constant*>(Vals, Vals+NumVals), Packed);
|
||||
}
|
||||
|
||||
Constant* ConstantStruct::get(LLVMContext &Context, bool Packed,
|
||||
Constant * Val, ...) {
|
||||
va_list ap;
|
||||
std::vector<Constant*> Values;
|
||||
va_start(ap, Val);
|
||||
while (Val) {
|
||||
Values.push_back(Val);
|
||||
Val = va_arg(ap, llvm::Constant*);
|
||||
}
|
||||
return get(Context, Values, Packed);
|
||||
}
|
||||
|
||||
ConstantVector::ConstantVector(const VectorType *T,
|
||||
const std::vector<Constant*> &V)
|
||||
: Constant(T, ConstantVectorVal,
|
||||
|
Loading…
x
Reference in New Issue
Block a user