Sema::ActOnObjCAtThrowStmt(): return from recently added errors. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64389 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 8b2e088..dd505f6 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -990,15 +990,15 @@
while (AtCatchParent && !AtCatchParent->isAtCatchScope())
AtCatchParent = AtCatchParent->getParent();
if (!AtCatchParent)
- Diag(AtLoc, diag::error_rethrow_used_outside_catch);
+ return StmtError(Diag(AtLoc, diag::error_rethrow_used_outside_catch));
} else {
QualType ThrowType = ThrowExpr->getType();
// Make sure the expression type is an ObjC pointer or "void *".
if (!Context.isObjCObjectPointerType(ThrowType)) {
const PointerType *PT = ThrowType->getAsPointerType();
if (!PT || !PT->getPointeeType()->isVoidType())
- Diag(AtLoc, diag::error_objc_throw_expects_object)
- << ThrowExpr->getType() << ThrowExpr->getSourceRange();
+ return StmtError(Diag(AtLoc, diag::error_objc_throw_expects_object)
+ << ThrowExpr->getType() << ThrowExpr->getSourceRange());
}
}
return Owned(new (Context) ObjCAtThrowStmt(AtLoc, ThrowExpr));