r225622 - Parse: Get rid of cxx_exceptspec_end, use EOF instead
David Majnemer
david.majnemer at gmail.com
Mon Jan 12 01:16:57 PST 2015
Author: majnemer
Date: Mon Jan 12 03:16:57 2015
New Revision: 225622
URL: http://llvm.org/viewvc/llvm-project?rev=225622&view=rev
Log:
Parse: Get rid of cxx_exceptspec_end, use EOF instead
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.
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=225622&r1=225621&r2=225622&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Mon Jan 12 03:16:57 2015
@@ -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)
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=225622&r1=225621&r2=225622&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Mon Jan 12 03:16:57 2015
@@ -418,7 +418,7 @@ void Parser::ParseLexedMethodDeclaration
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
// 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;
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=225622&r1=225621&r2=225622&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Jan 12 03:16:57 2015
@@ -3163,8 +3163,9 @@ Parser::tryParseExceptionSpecification(b
// 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;
}
More information about the cfe-commits
mailing list