1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Assert that ConstantArrays are created with correctly-typed elements.

llvm-svn: 83168
This commit is contained in:
Jeffrey Yasskin 2009-09-30 21:08:08 +00:00
parent 2ecc146f0c
commit 2d4f3f6704

View File

@ -482,6 +482,10 @@ ConstantArray::ConstantArray(const ArrayType *T,
Constant *ConstantArray::get(const ArrayType *Ty,
const std::vector<Constant*> &V) {
for (unsigned i = 0, e = V.size(); i != e; ++i) {
assert(V[i]->getType() == Ty->getElementType() &&
"Wrong type in array element initializer");
}
LLVMContextImpl *pImpl = Ty->getContext().pImpl;
// If this is an all-zero array, return a ConstantAggregateZero object
if (!V.empty()) {
@ -2140,4 +2144,3 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
// Delete the old constant!
destroyConstant();
}