diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-01-04 21:25:24 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-01-04 21:25:24 +0000 |
| commit | 109faf2b8b6f01b941fd257a4850e57c7c9a0a2e (patch) | |
| tree | 047d515544f5b28d6f3938010de7aee5565a1b63 /clang/lib/Parse/ParseExpr.cpp | |
| parent | f9b2cd4d92a7a645c66211a9a759ab20e5eb29a4 (diff) | |
| download | bcm5719-llvm-109faf2b8b6f01b941fd257a4850e57c7c9a0a2e.tar.gz bcm5719-llvm-109faf2b8b6f01b941fd257a4850e57c7c9a0a2e.zip | |
eliminate lookahead when parsing ::new / ::delete.
llvm-svn: 61638
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 0c25fab4f44..f719b8914f5 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -626,19 +626,23 @@ Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression) { Res = ParseCXXIdExpression(); return ParsePostfixExpressionSuffix(move(Res)); - case tok::coloncolon: // [C++] new-expression or [C++] delete-expression - // If the next token is neither 'new' nor 'delete', the :: would have been - // parsed as a scope specifier already. - if (NextToken().is(tok::kw_new)) - return ParseCXXNewExpression(); - else - return ParseCXXDeleteExpression(); + case tok::coloncolon: { // [C++] new-expression or [C++] delete-expression + SourceLocation ScopeLoc = ConsumeToken(); + if (Tok.is(tok::kw_new)) + return ParseCXXNewExpression(true, ScopeLoc); + else { + // If the next token is neither 'new' nor 'delete', the :: would have been + // parsed as a scope specifier already. + assert(Tok.is(tok::kw_delete)); + return ParseCXXDeleteExpression(true, ScopeLoc); + } + } case tok::kw_new: // [C++] new-expression - return ParseCXXNewExpression(); + return ParseCXXNewExpression(false, Tok.getLocation()); case tok::kw_delete: // [C++] delete-expression - return ParseCXXDeleteExpression(); + return ParseCXXDeleteExpression(false, Tok.getLocation()); case tok::at: { SourceLocation AtLoc = ConsumeToken(); |

