1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Check struct return type first.

llvm-svn: 47922
This commit is contained in:
Devang Patel 2008-03-05 00:27:05 +00:00
parent 37f5b4586a
commit a97b000dcc

View File

@ -581,16 +581,17 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
Assert2(F->getReturnType() == Type::VoidTy, Assert2(F->getReturnType() == Type::VoidTy,
"Found return instr that returns void in Function of non-void " "Found return instr that returns void in Function of non-void "
"return type!", &RI, F->getReturnType()); "return type!", &RI, F->getReturnType());
else if (N == 1)
Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
"Function return type does not match operand "
"type of return inst!", &RI, F->getReturnType());
else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) { else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
for (unsigned i = 0; i < N; i++) for (unsigned i = 0; i < N; i++)
Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(), Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
"Function return type does not match operand " "Function return type does not match operand "
"type of return inst!", &RI, F->getReturnType()); "type of return inst!", &RI, F->getReturnType());
} else }
else if (N == 1)
Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
"Function return type does not match operand "
"type of return inst!", &RI, F->getReturnType());
else
Assert1(0, "Invalid return type!", &RI); Assert1(0, "Invalid return type!", &RI);
// Check to make sure that the return value has necessary properties for // Check to make sure that the return value has necessary properties for