forked from OSchip/llvm-project
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. llvm-svn: 69464
This commit is contained in:
parent
3318e86541
commit
f95894c1d2
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue