Index: Constants.h =================================================================== --- Constants.h +++ Constants.h @@ -698,9 +698,8 @@ template static Constant *get(LLVMContext &Context, ArrayRef Elts) { const char *Data = reinterpret_cast(Elts.data()); - Type *Ty = - ArrayType::get(Type::getScalarTy(Context), Elts.size()); - return getImpl(StringRef(Data, Elts.size() * sizeof(ElementTy)), Ty); + return get(StringRef(Data, Elts.size() * sizeof(ElementTy)), Elts.size(), + Type::getScalarTy(Context)); } /// get() constructor - ArrayTy needs to be compatible with @@ -710,6 +709,14 @@ return ConstantDataArray::get(Context, makeArrayRef(Elts)); } + /// get() constructor - Return a constant with array type with an element + /// count and element type matching the NumElements and ElementTy parameters + /// passed in. Note that this can return a ConstantAggregateZero object. + static Constant *get(StringRef Data, uint64_t NumElements, Type *ElementTy) { + Type *Ty = ArrayType::get(ElementTy, NumElements); + return getImpl(Data, Ty); + } + /// getFP() constructors - Return a constant with array type with an element /// count and element type of float with precision matching the number of /// bits in the ArrayRef passed in. (i.e. half for 16bits, float for 32bits,