aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-17 23:58:47 +0000
committerChris Lattner <sabre@nondot.org>2011-02-17 23:58:47 +0000
commite476bdce8cf3315c8ce852480503a8acc265bd54 (patch)
tree59e3474a9df87b1653af09f7afba82342d86bdb1 /lib/Sema/SemaExpr.cpp
parentd8df5b65fc76c2f59148e1551f56a8ee26c9607b (diff)
make block bodies handle undefined labels just like functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125799 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExpr.cpp')
-rw-r--r--lib/Sema/SemaExpr.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 6892424e09..6d339fd97c 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -8800,7 +8800,7 @@ void Sema::ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope) {
/// ActOnBlockStmtExpr - This is called when the body of a block statement
/// literal was successfully completed. ^(int x){...}
ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
- Stmt *Body, Scope *CurScope) {
+ Stmt *Body, Scope *CurScope) {
// If blocks are disabled, emit an error.
if (!LangOpts.Blocks)
Diag(CaretLoc, diag::err_blocks_disable);
@@ -8866,13 +8866,10 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
if (getCurFunction()->NeedsScopeChecking() && !hasAnyErrorsInThisFunction())
DiagnoseInvalidJumps(cast<CompoundStmt>(Body));
- BSI->TheDecl->setBody(cast<CompoundStmt>(Body));
-
// Check goto/label use.
- if (BSI->checkLabelUse(0, *this)) {
- PopFunctionOrBlockScope();
- return ExprError();
- }
+ BSI->checkLabelUse(Body, *this);
+
+ BSI->TheDecl->setBody(cast<CompoundStmt>(Body));
BlockExpr *Result = new (Context) BlockExpr(BSI->TheDecl, BlockTy);