r225620 - Parse: Just a small tidy-up in ParseLexedMethodDeclaration

David Majnemer david.majnemer at gmail.com
Sun Jan 11 22:51:15 PST 2015


Author: majnemer
Date: Mon Jan 12 00:51:15 2015
New Revision: 225620

URL: http://llvm.org/viewvc/llvm-project?rev=225620&view=rev
Log:
Parse: Just a small tidy-up in ParseLexedMethodDeclaration

No functional change intended, just tidy up the parse flow.

Modified:
    cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp

Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=225620&r1=225619&r2=225620&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Mon Jan 12 00:51:15 2015
@@ -337,14 +337,16 @@ void Parser::ParseLexedMethodDeclaration
         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.





More information about the cfe-commits mailing list