]> granicus.if.org Git - clang/commitdiff
Parse: Get rid of cxx_exceptspec_end, use EOF instead
authorDavid Majnemer <david.majnemer@gmail.com>
Mon, 12 Jan 2015 09:16:57 +0000 (09:16 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Mon, 12 Jan 2015 09:16:57 +0000 (09:16 +0000)
Similar to r225619, use a special EOF token to mark the end of the
exception specification instead of cxx_exceptspec_end.  Use the current
scope as the marker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225622 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/TokenKinds.def
lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseDeclCXX.cpp

index e0cc3631ff02f3457fe82458193dfe9f0b05c0d4..da106227c28c401729b7f8d9658a63e6c665b09b 100644 (file)
@@ -116,7 +116,6 @@ TOK(eof)                 // End of file.
 TOK(eod)                 // End of preprocessing directive (end of line inside a
                          // directive).
 TOK(code_completion)     // Code completion marker
-TOK(cxx_exceptspec_end)  // C++ exception-specification end marker
 
 // C99 6.4.9: Comments.
 TOK(comment)             // Comment (only in -E -C[C] mode)
index 0d5bb2e97d466dd3d3d495a486f0ceb2cfe3fd56..03784b4f5ea138bcd5bf03b86b4ac7ba75c3c2ca 100644 (file)
@@ -418,7 +418,7 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
                                        ExceptionSpecTokens);
 
     // Clean up the remaining tokens.
-    if (Tok.is(tok::cxx_exceptspec_end))
+    if (Tok.is(tok::eof) && Tok.getEofData() == Actions.CurScope)
       ConsumeToken();
     else if (EST != EST_None)
       Diag(Tok.getLocation(), diag::err_except_spec_unparsed);
@@ -437,8 +437,11 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
 
     // 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() != Actions.CurScope)
+        break;
       ConsumeAnyToken();
+    }
 
     delete Toks;
     LM.ExceptionSpecTokens = nullptr;
index 10568b3671b5a2f6837cd91cd585f77b99f356f4..09239f467ea3eb8e101c6cbab9ed26dfe5e40146 100644 (file)
@@ -3163,8 +3163,9 @@ Parser::tryParseExceptionSpecification(bool Delayed,
     // Add the 'stop' token.
     Token End;
     End.startToken();
-    End.setKind(tok::cxx_exceptspec_end);
+    End.setKind(tok::eof);
     End.setLocation(Tok.getLocation());
+    End.setEofData(Actions.CurScope);
     ExceptionSpecTokens->push_back(End);
     return EST_Unparsed;
   }