summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/RAIIObjectsForParser.h
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-05-12 21:36:35 +0000
committerRichard Trieu <rtrieu@google.com>2015-05-12 21:36:35 +0000
commit1d3b58e317963882ce2314f153b3e315833fd04b (patch)
tree992d1837e22db8caabc40b97be0c1adf0e31849b /clang/lib/Parse/RAIIObjectsForParser.h
parent08d7027cc1eb6ac8e9d54ab469e04b1f22a1d3c6 (diff)
downloadbcm5719-llvm-1d3b58e317963882ce2314f153b3e315833fd04b.tar.gz
bcm5719-llvm-1d3b58e317963882ce2314f153b3e315833fd04b.zip
Add a new error for unexpected semi-colon before closing delimiter.
Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or '}', two errors and one note would emitted, and the parsing would get confused to which scope it was in. This change consumes the semi-colon, recovers parsing better, and emits only one error with a fix-it. llvm-svn: 237192
Diffstat (limited to 'clang/lib/Parse/RAIIObjectsForParser.h')
-rw-r--r--clang/lib/Parse/RAIIObjectsForParser.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Parse/RAIIObjectsForParser.h b/clang/lib/Parse/RAIIObjectsForParser.h
index c2f49804195..36d87ebd8ac 100644
--- a/clang/lib/Parse/RAIIObjectsForParser.h
+++ b/clang/lib/Parse/RAIIObjectsForParser.h
@@ -429,7 +429,13 @@ namespace clang {
if (P.Tok.is(Close)) {
LClose = (P.*Consumer)();
return false;
- }
+ } else if (P.Tok.is(tok::semi) && P.NextToken().is(Close)) {
+ SourceLocation SemiLoc = P.ConsumeToken();
+ P.Diag(SemiLoc, diag::err_unexpected_semi)
+ << Close << FixItHint::CreateRemoval(SourceRange(SemiLoc, SemiLoc));
+ LClose = (P.*Consumer)();
+ return false;
+ }
return diagnoseMissingClose();
}
OpenPOWER on IntegriCloud