]> granicus.if.org Git - clang/commitdiff
revert a hunk of code that Argiris added in r106213, which is the
authorChris Lattner <sabre@nondot.org>
Mon, 12 Jul 2010 01:48:28 +0000 (01:48 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Jul 2010 01:48:28 +0000 (01:48 +0000)
root cause of PR7481 and probably more, and has no apparent
testcases.  I don't understand the logic here so I can't repair it.

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

lib/Parse/Parser.cpp
test/Parser/bracket-crash.cpp [new file with mode: 0644]

index def2ca4088b47135d1f555156390f9e8e44b01ca..02fac16905298bf437b1114c5de002297c7c2a77 100644 (file)
@@ -127,16 +127,7 @@ SourceLocation Parser::MatchRHSPunctuation(tok::TokenKind RHSTok,
   }
   Diag(Tok, DID);
   Diag(LHSLoc, diag::note_matching) << LHSName;
-  if (!SkipUntil(RHSTok)) {
-    // We stopped before finding a RHS token, e.g. we encountered a ';'.
-    // Balance Paren/Brace/Bracket counting. 
-    switch (RHSTok) {
-    default: break;
-    case tok::r_paren : assert(ParenCount > 0); --ParenCount; break;
-    case tok::r_brace : assert(BraceCount > 0); --BraceCount; break;
-    case tok::r_square: assert(BracketCount > 0); --BracketCount; break;
-    }
-  }
+  SkipUntil(RHSTok);
   return R;
 }
 
diff --git a/test/Parser/bracket-crash.cpp b/test/Parser/bracket-crash.cpp
new file mode 100644 (file)
index 0000000..fd18e0e
--- /dev/null
@@ -0,0 +1,6 @@
+// RUN: not %clang_cc1 -fsyntax-only %s
+// PR7481
+struct{
+  a
+}
+