aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDeclCXX.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-17 20:10:43 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-17 20:10:43 +0000
commit7d033b209e87d1964ee2f8de668934bb1a77bde0 (patch)
tree88cb7690721cb03e019c7223b1843ccc7f1e4391 /lib/Parse/ParseDeclCXX.cpp
parent39cf781d62daaec09e443c6e66a01cd7543ffb41 (diff)
[parser] Push a semi token for recovery only when it is actually missing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170363 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r--lib/Parse/ParseDeclCXX.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 2e7592f4dd..76ec647786 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1543,13 +1543,15 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
// is permitted.
if (TUK == Sema::TUK_Definition &&
(TemplateInfo.Kind || !isValidAfterTypeSpecifier(false))) {
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
- DeclSpec::getSpecifierName(TagType));
- // Push this token back into the preprocessor and change our current token
- // to ';' so that the rest of the code recovers as though there were an
- // ';' after the definition.
- PP.EnterToken(Tok);
- Tok.setKind(tok::semi);
+ if (Tok.isNot(tok::semi)) {
+ ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
+ DeclSpec::getSpecifierName(TagType));
+ // Push this token back into the preprocessor and change our current token
+ // to ';' so that the rest of the code recovers as though there were an
+ // ';' after the definition.
+ PP.EnterToken(Tok);
+ Tok.setKind(tok::semi);
+ }
}
}