Parse: Get rid of tok::cxx_defaultarg_end, use EOF instead

I added setEofData/getEofData to solve this sort of problem back in
r224505.  Use the Param's decl to tell us if this is *our* EOF token.

llvm-svn: 225619
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp
index ccd0517..375041e 100644
--- a/clang/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp
@@ -342,7 +342,9 @@
         Actions.ActOnParamDefaultArgumentError(LM.DefaultArgs[I].Param,
                                                EqualLoc);
       else {
-        if (!TryConsumeToken(tok::cxx_defaultarg_end)) {
+        if (Tok.is(tok::eof) && Tok.getEofData() == LM.DefaultArgs[I].Param) {
+          ConsumeAnyToken();
+        } else {
           // 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.
@@ -360,8 +362,11 @@
              "ParseAssignmentExpression went over the default arg tokens!");
       // There could be leftover tokens (e.g. because of an error).
       // Skip through until we reach the original token position.
-      while (Tok.getLocation() != origLoc && Tok.isNot(tok::eof))
+      while (Tok.getLocation() != origLoc) {
+        if (Tok.is(tok::eof) && Tok.getEofData() != LM.DefaultArgs[I].Param)
+          break;
         ConsumeAnyToken();
+      }
 
       delete Toks;
       LM.DefaultArgs[I].Toks = nullptr;
@@ -652,7 +657,6 @@
 
     switch (Tok.getKind()) {
     case tok::eof:
-    case tok::cxx_defaultarg_end:
     case tok::annot_module_begin:
     case tok::annot_module_end:
     case tok::annot_module_include:
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 7ff39aa..66366d9 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -5631,8 +5631,9 @@
             // stop when we parse it later on.
             Token DefArgEnd;
             DefArgEnd.startToken();
-            DefArgEnd.setKind(tok::cxx_defaultarg_end);
+            DefArgEnd.setKind(tok::eof);
             DefArgEnd.setLocation(Tok.getLocation());
+            DefArgEnd.setEofData(Param);
             DefArgToks->push_back(DefArgEnd);
             Actions.ActOnParamUnparsedDefaultArgument(Param, EqualLoc,
                                                 (*DefArgToks)[1].getLocation());
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 06a70f7..7ccd209 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -262,10 +262,6 @@
       // Ran out of tokens.
       return false;
 
-    case tok::cxx_defaultarg_end:
-      // It's never desirable to consume the 'end-of-default-argument' token.
-      return false;
-
     case tok::annot_pragma_openmp_end:
       // Stop before an OpenMP pragma boundary.
     case tok::annot_module_begin: