aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-25 17:27:01 +0000
committerChris Lattner <sabre@nondot.org>2007-10-25 17:27:01 +0000
commite61933ddb958cda2650891ec12521169638cf5c9 (patch)
treeebaa8725b972b10e2f3f0b4ec9e8578b5664d770
parentd6690b20b3340f30a225dffa49603951dcd75e4e (diff)
Fix a recovery bug Fariborz and I noticed yesterday. We were producing:
method.c:4:3: error: use of undeclared identifier 'BADIDENT' &BADIDENT, 0 ^ method.c:5:2: error: expected '}' }; ^ method.c:3:14: error: to match this '{' struct S A = { ^ now we only produce: method.c:4:3: error: use of undeclared identifier 'BADIDENT' &BADIDENT, 0 ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43349 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Parse/ParseInit.cpp2
-rw-r--r--test/Parser/recovery-1.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/Parse/ParseInit.cpp b/Parse/ParseInit.cpp
index 63687408d7..c4ecd26f1b 100644
--- a/Parse/ParseInit.cpp
+++ b/Parse/ParseInit.cpp
@@ -175,7 +175,7 @@ Parser::ExprResult Parser::ParseInitializer() {
// If we couldn't parse the subelement, bail out.
if (SubElt.isInvalid) {
InitExprsOk = false;
- SkipUntil(tok::r_brace);
+ SkipUntil(tok::r_brace, false, true);
break;
} else
InitExprs.push_back(SubElt.Val);
diff --git a/test/Parser/recovery-1.c b/test/Parser/recovery-1.c
index b37c88cba0..b7270b572a 100644
--- a/test/Parser/recovery-1.c
+++ b/test/Parser/recovery-1.c
@@ -5,3 +5,12 @@ char (((( /* expected-error {{to match this '('}} */
*X x ] )))); /* expected-error {{expected ')'}} */
; // expected-warning {{ISO C does not allow an extra ';' outside of a function}}
+
+
+
+
+struct S { void *X, *Y; };
+
+struct S A = {
+ &BADIDENT, 0 /* expected-error {{use of undeclared identifier}} */
+};