forked from OSchip/llvm-project
When creating constant arrays check that the initializer vector is the
same size as the one in the array type. llvm-svn: 16354
This commit is contained in:
parent
4bf01357e1
commit
0507ffebb1
|
@ -245,6 +245,8 @@ ConstantFP::ConstantFP(const Type *Ty, double V) : Constant(Ty) {
|
||||||
|
|
||||||
ConstantArray::ConstantArray(const ArrayType *T,
|
ConstantArray::ConstantArray(const ArrayType *T,
|
||||||
const std::vector<Constant*> &V) : Constant(T) {
|
const std::vector<Constant*> &V) : Constant(T) {
|
||||||
|
assert(V.size() == T->getNumElements() &&
|
||||||
|
"Invalid initializer vector for constant array");
|
||||||
Operands.reserve(V.size());
|
Operands.reserve(V.size());
|
||||||
for (unsigned i = 0, e = V.size(); i != e; ++i) {
|
for (unsigned i = 0, e = V.size(); i != e; ++i) {
|
||||||
assert((V[i]->getType() == T->getElementType() ||
|
assert((V[i]->getType() == T->getElementType() ||
|
||||||
|
|
Loading…
Reference in New Issue