diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-01-12 05:17:40 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-01-12 05:17:40 +0000 |
commit | 06b7d006b82c4279d603be4daca228d0028d12eb (patch) | |
tree | 2659f531d82a8ede610f81270703fd0f01d2a647 /clang/lib/Parse/ParseCXXInlineMethods.cpp | |
parent | 06a5dd69e29bc5d75204b141773d1946a4fc007d (diff) | |
download | bcm5719-llvm-06b7d006b82c4279d603be4daca228d0028d12eb.tar.gz bcm5719-llvm-06b7d006b82c4279d603be4daca228d0028d12eb.zip |
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
Diffstat (limited to 'clang/lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index ccd051721fa..375041ebe12 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -342,7 +342,9 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) { 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 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) { "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 @@ bool Parser::ConsumeAndStoreUntil(tok::TokenKind T1, tok::TokenKind T2, 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: |