diff options
author | Richard Trieu <rtrieu@google.com> | 2015-05-12 21:36:35 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2015-05-12 21:36:35 +0000 |
commit | 1d3b58e317963882ce2314f153b3e315833fd04b (patch) | |
tree | 992d1837e22db8caabc40b97be0c1adf0e31849b /clang/lib/Parse/RAIIObjectsForParser.h | |
parent | 08d7027cc1eb6ac8e9d54ab469e04b1f22a1d3c6 (diff) | |
download | bcm5719-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.h | 8 |
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(); } |