mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-20 12:31:40 +00:00
strengthen up an assertion: you can't create a constant struct
with an opaque struct type, it doesn't make sense. This should resolve PR10473. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137028 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
69145baf36
commit
f4ef8db7cd
@ -652,7 +652,7 @@ ConstantStruct::ConstantStruct(StructType *T, ArrayRef<Constant *> V)
|
|||||||
: Constant(T, ConstantStructVal,
|
: Constant(T, ConstantStructVal,
|
||||||
OperandTraits<ConstantStruct>::op_end(this) - V.size(),
|
OperandTraits<ConstantStruct>::op_end(this) - V.size(),
|
||||||
V.size()) {
|
V.size()) {
|
||||||
assert((T->isOpaque() || V.size() == T->getNumElements()) &&
|
assert(V.size() == T->getNumElements() &&
|
||||||
"Invalid initializer vector for constant structure");
|
"Invalid initializer vector for constant structure");
|
||||||
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
||||||
assert((T->isOpaque() || V[i]->getType() == T->getElementType(i)) &&
|
assert((T->isOpaque() || V[i]->getType() == T->getElementType(i)) &&
|
||||||
@ -672,7 +672,7 @@ Constant *ConstantStruct::get(StructType *ST, ArrayRef<Constant*> V) {
|
|||||||
return ConstantAggregateZero::get(ST);
|
return ConstantAggregateZero::get(ST);
|
||||||
}
|
}
|
||||||
|
|
||||||
Constant* ConstantStruct::get(StructType *T, ...) {
|
Constant *ConstantStruct::get(StructType *T, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
SmallVector<Constant*, 8> Values;
|
SmallVector<Constant*, 8> Values;
|
||||||
va_start(ap, T);
|
va_start(ap, T);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user