diff options
author | Alp Toker <alp@nuanti.com> | 2014-01-05 03:27:11 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-01-05 03:27:11 +0000 |
commit | 094e521e3fa1459991e62ae320076a6f930b134e (patch) | |
tree | 077af3dee1e6a8979a4902a2320ac0638524474f /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 0db10c4feff8e1933f53811bff38737b18cf1af1 (diff) | |
download | bcm5719-llvm-094e521e3fa1459991e62ae320076a6f930b134e.tar.gz bcm5719-llvm-094e521e3fa1459991e62ae320076a6f930b134e.zip |
Parse: Token consumption modernization and loop de-nesting
Cleanup only.
llvm-svn: 198539
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index d3283eb21bd..76973aee4fa 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -2365,12 +2365,10 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // If we don't have a comma, it is either the end of the list (a ';') // or an error, bail out. - if (Tok.isNot(tok::comma)) + SourceLocation CommaLoc; + if (!TryConsumeToken(tok::comma, CommaLoc)) break; - // Consume the comma. - SourceLocation CommaLoc = ConsumeToken(); - if (Tok.isAtStartOfLine() && !MightBeDeclarator(Declarator::MemberContext)) { // This comma was followed by a line-break and something which can't be @@ -2439,8 +2437,7 @@ ExprResult Parser::ParseCXXMemberInitializer(Decl *D, bool IsFunction, EnterExpressionEvaluationContext Context(Actions, Sema::PotentiallyEvaluated, D); - if (Tok.is(tok::equal)) { - EqualLoc = ConsumeToken(); + if (TryConsumeToken(tok::equal, EqualLoc)) { if (Tok.is(tok::kw_delete)) { // In principle, an initializer of '= delete p;' is legal, but it will // never type-check. It's better to diagnose it as an ill-formed expression @@ -2868,8 +2865,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { return true; SourceLocation EllipsisLoc; - if (Tok.is(tok::ellipsis)) - EllipsisLoc = ConsumeToken(); + TryConsumeToken(tok::ellipsis, EllipsisLoc); return Actions.ActOnMemInitializer(ConstructorDecl, getCurScope(), SS, II, TemplateTypeTy, DS, IdLoc, |