summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-02-26 22:55:21 +0000
committerDevang Patel <dpatel@apple.com>2008-02-26 22:55:21 +0000
commitf287e7dcc6d9b5880c7f86c61b4867908b56b369 (patch)
treef48b2249aacdefa2ab0bd1ec6eabd7be729584f5 /llvm/lib
parentdea8c07899df99178750b7df4842c1ab48616349 (diff)
downloadbcm5719-llvm-f287e7dcc6d9b5880c7f86c61b4867908b56b369.tar.gz
bcm5719-llvm-f287e7dcc6d9b5880c7f86c61b4867908b56b369.zip
Add assert to check return type.
llvm-svn: 47637
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Verifier.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp
index 1a7100e5a4a..e86c89bfa82 100644
--- a/llvm/lib/VMCore/Verifier.cpp
+++ b/llvm/lib/VMCore/Verifier.cpp
@@ -585,13 +585,13 @@ void Verifier::visitReturnInst(ReturnInst &RI) {
Assert2(F->getReturnType() == RI.getOperand(0)->getType(),
"Function return type does not match operand "
"type of return inst!", &RI, F->getReturnType());
- else {
- const StructType *STy = cast<StructType>(F->getReturnType());
+ else if (const StructType *STy = dyn_cast<StructType>(F->getReturnType())) {
for (unsigned i = 0; i < N; i++)
Assert2(STy->getElementType(i) == RI.getOperand(i)->getType(),
- "Function return type does not match operand "
- "type of return inst!", &RI, F->getReturnType());
- }
+ "Function return type does not match operand "
+ "type of return inst!", &RI, F->getReturnType());
+ } else
+ Assert1(0, "Invalid return type!", &RI);
// Check to make sure that the return value has necessary properties for
// terminators...
OpenPOWER on IntegriCloud