]> granicus.if.org Git - clang/commitdiff
fix two error paths out of ParseBlockLiteralExpression to
authorChris Lattner <sabre@nondot.org>
Sat, 18 Apr 2009 20:05:34 +0000 (20:05 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Apr 2009 20:05:34 +0000 (20:05 +0000)
call ActOnBlockError so that CurBlock gets popped.  This
fixes a crash on test/block-syntax-error.c when this new
assertion is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69464 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
lib/Sema/SemaDecl.cpp

index 47e364e36147a1c86984c07d405063fff7963233..ec36fedc2d21bc2f153109ab4f4c84c5379f5a7a 100644 (file)
@@ -1342,6 +1342,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
       // If there was an error parsing the arguments, they may have
       // tried to use ^(x+y) which requires an argument list.  Just
       // skip the whole block literal.
+      Actions.ActOnBlockError(CaretLoc, CurScope);
       return ExprError();
     }
     // Inform sema that we are starting a block.
@@ -1364,6 +1365,7 @@ Parser::OwningExprResult Parser::ParseBlockLiteralExpression() {
   if (!Tok.is(tok::l_brace)) {
     // Saw something like: ^expr
     Diag(Tok, diag::err_expected_expression);
+    Actions.ActOnBlockError(CaretLoc, CurScope);
     return ExprError();
   }
   
index 4df6feec9f67d24883034321ed58d8bb3f5f796d..b580b01bc45d33a57bade558d6cba2efbd35230e 100644 (file)
@@ -3155,7 +3155,7 @@ Sema::DeclPtrTy Sema::ActOnFinishFunctionBody(DeclPtrTy D, StmtArg BodyArg) {
   PopDeclContext();
   // Verify and clean out per-function state.
 
-  //assert(&getLabelMap() == &FunctionLabelMap && "Didn't pop block right?");
+  assert(&getLabelMap() == &FunctionLabelMap && "Didn't pop block right?");
   
   bool HaveLabels = !FunctionLabelMap.empty();
   // Check goto/label use.