Invalid compound statements that weren't followed by a right paren
weren't being reported:
http://llvm.org/bugs/show_bug.cgi?id=8394
This patch fixes that. Could somebody please review and commit it?
commit 4c22cdf0a136f334d6b4341738ea774ab556d53e
Author: Justin Bogner <[email protected]>
Date: Sun Mar 27 19:13:35 2011 -0600
Don't ignore errors caused by missing right parens. Fixes 8394.
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 510e2c2..47ffc1c 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1639,7 +1639,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
ExprType = CompoundStmt;
// If the substmt parsed correctly, build the AST node.
- if (!Stmt.isInvalid() && Tok.is(tok::r_paren))
+ if (!Stmt.isInvalid())
Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.take(), Tok.getLocation());
} else if (ExprType >= CompoundLiteral &&
@@ -1737,7 +1737,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
Result = ParseExpression();
ExprType = SimpleExpr;
- if (!Result.isInvalid() && Tok.is(tok::r_paren))
+ if (!Result.isInvalid())
Result = Actions.ActOnParenExpr(OpenLoc, Tok.getLocation(), Result.take());
}
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index 6015e91..0d1b6c9 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -51,3 +51,9 @@ int test6(void) {
test5(1)
; // expected-error {{expected ')'}}
}
+
+// PR8394
+void test7() {
+ ({} // expected-note {{to match}}
+ ; // expected-error {{expected ')'}}
+}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits