diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-03-05 19:34:00 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-03-05 19:34:00 +0000 |
commit | abf9d908cce6ffe2ee7b739d98fc7344a4f9fe3b (patch) | |
tree | 78ff3c89d85ee81fc80ef1962d1c9add5b2e6b6a /lib/Sema/SemaExpr.cpp | |
parent | a187c5cc7cbc4931ef488374648348de5c057aee (diff) |
patch to optionally warn for block implementations without explicit
return types that return non-void values. // rdar://10735698
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152047 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index ab96f7416f..aba38db035 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -8902,7 +8902,12 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc, ExprCleanupObjects.push_back(Result->getBlockDecl()); ExprNeedsCleanups = true; } - + + if (BSI->TheDecl->blockMissingReturnType() && + !RetTy->isDependentType() && + !Context.getCanonicalType(RetTy)->isVoidType()) + Diag(CaretLoc, diag::warn_block_missing_return_type); + return Owned(Result); } |