]> granicus.if.org Git - clang/commitdiff
Parse: Just a small tidy-up in ParseLexedMethodDeclaration
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 12 Jan 2015 06:51:15 +0000 (06:51 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 12 Jan 2015 06:51:15 +0000 (06:51 +0000)
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

lib/Parse/ParseCXXInlineMethods.cpp

index 375041ebe12b31ab82553ebb7d1834f28a175c4a..0d5bb2e97d466dd3d3d495a486f0ceb2cfe3fd56 100644 (file)
@@ -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.