mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +00:00
Add assertion descriptiosn on type mismatches when creating
ConstantArray and ConstantPacked objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
24fdc1d1df
commit
cad90ad162
@ -247,9 +247,10 @@ ConstantArray::ConstantArray(const ArrayType *T,
|
|||||||
const std::vector<Constant*> &V) : Constant(T) {
|
const std::vector<Constant*> &V) : Constant(T) {
|
||||||
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() ||
|
||||||
(T->isAbstract() &&
|
(T->isAbstract() &&
|
||||||
V[i]->getType()->getTypeID() == T->getElementType()->getTypeID()));
|
V[i]->getType()->getTypeID() == T->getElementType()->getTypeID())) &&
|
||||||
|
"Initializer for array element doesn't match array element type!");
|
||||||
Operands.push_back(Use(V[i], this));
|
Operands.push_back(Use(V[i], this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,9 +274,10 @@ ConstantPacked::ConstantPacked(const PackedType *T,
|
|||||||
const std::vector<Constant*> &V) : Constant(T) {
|
const std::vector<Constant*> &V) : Constant(T) {
|
||||||
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() ||
|
||||||
(T->isAbstract() &&
|
(T->isAbstract() &&
|
||||||
V[i]->getType()->getTypeID() == T->getElementType()->getTypeID()));
|
V[i]->getType()->getTypeID() == T->getElementType()->getTypeID())) &&
|
||||||
|
"Initializer for packed element doesn't match packed element type!");
|
||||||
Operands.push_back(Use(V[i], this));
|
Operands.push_back(Use(V[i], this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user