From: David Majnemer Date: Mon, 12 Jan 2015 06:51:15 +0000 (+0000) Subject: Parse: Just a small tidy-up in ParseLexedMethodDeclaration X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fca6fffe0e38b106020c64394614d66062b8b864;p=clang Parse: Just a small tidy-up in ParseLexedMethodDeclaration No functional change intended, just tidy up the parse flow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225620 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index 375041ebe1..0d5bb2e97d 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -337,14 +337,16 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) { DefArgResult = ParseBraceInitializer(); } else DefArgResult = ParseAssignmentExpression(); + bool DefArgTokenFound = + Tok.is(tok::eof) && Tok.getEofData() == LM.DefaultArgs[I].Param; + if (DefArgTokenFound) + ConsumeAnyToken(); DefArgResult = Actions.CorrectDelayedTyposInExpr(DefArgResult); - if (DefArgResult.isInvalid()) + if (DefArgResult.isInvalid()) { Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param, EqualLoc); - else { - if (Tok.is(tok::eof) && Tok.getEofData() == LM.DefaultArgs[I].Param) { - ConsumeAnyToken(); - } else { + } else { + if (!DefArgTokenFound) { // The last two tokens are the terminator and the saved value of // Tok; the last token in the default argument is the one before // those.