[cfe-commits] r69464 - in /cfe/trunk/lib: Parse/ParseExpr.cpp Sema/SemaDecl.cpp

Chris Lattner sabre at nondot.org
Sat Apr 18 13:05:34 PDT 2009


Author: lattner
Date: Sat Apr 18 15:05:34 2009
New Revision: 69464

URL: http://llvm.org/viewvc/llvm-project?rev=69464&view=rev
Log:
fix two error paths out of ParseBlockLiteralExpression to
call ActOnBlockError so that CurBlock gets popped.  This
fixes a crash on test/block-syntax-error.c when this new
assertion is enabled.

Modified:
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=69464&r1=69463&r2=69464&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Sat Apr 18 15:05:34 2009
@@ -1342,6 +1342,7 @@
       // 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 @@
   if (!Tok.is(tok::l_brace)) {
     // Saw something like: ^expr
     Diag(Tok, diag::err_expected_expression);
+    Actions.ActOnBlockError(CaretLoc, CurScope);
     return ExprError();
   }
   

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=69464&r1=69463&r2=69464&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Apr 18 15:05:34 2009
@@ -3155,7 +3155,7 @@
   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.





More information about the cfe-commits mailing list