summaryrefslogtreecommitdiffstats
path: root/clang/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
commite6f6913bec42d00e6b02195c10b20c027b8b5c29 (patch)
tree227733999d512baffe0b4ac5493150f53f37839d /clang/lib/Parse/ParseDeclCXX.cpp
parentad3704c96a8b19cbc0188550d6a9b0bef44fcc27 (diff)
downloadbcm5719-llvm-e6f6913bec42d00e6b02195c10b20c027b8b5c29.tar.gz
bcm5719-llvm-e6f6913bec42d00e6b02195c10b20c027b8b5c29.zip
[parser] Push a semi token for recovery only when it is actually missing.
llvm-svn: 170363
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r--clang/lib/Parse/ParseDeclCXX.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp
index 2e7592f4dd9..76ec6477868 100644
--- a/clang/lib/Parse/ParseDeclCXX.cpp
+++ b/clang/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);
+ }
}
}
OpenPOWER on IntegriCloud