diff options
| author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-21 19:14:01 +0000 |
|---|---|---|
| committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-21 19:14:01 +0000 |
| commit | bd150f431e8288778013492c0ec095b1b4848564 (patch) | |
| tree | da0e3264b09159011f4cebc8aa135d3e7edb5001 /clang/lib/Parse/ParseExpr.cpp | |
| parent | 8dfa51c5efe2e0b7da9f66e7d5d1d29931430630 (diff) | |
| download | bcm5719-llvm-bd150f431e8288778013492c0ec095b1b4848564.tar.gz bcm5719-llvm-bd150f431e8288778013492c0ec095b1b4848564.zip | |
Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.
llvm-svn: 59835
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 74b0715de2a..9f9b306c45f 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -351,6 +351,8 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, unsigned MinPrec) { /// [GNU] '__alignof' '(' type-name ')' /// [C++0x] 'alignof' '(' type-id ')' /// [GNU] '&&' identifier +/// [C++] new-expression +/// [C++] delete-expression /// /// unary-operator: one of /// '&' '*' '+' '-' '~' '!' @@ -405,6 +407,16 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, unsigned MinPrec) { /// '~' class-name [TODO] /// template-id [TODO] /// +/// new-expression: [C++ 5.3.4] +/// '::'[opt] 'new' new-placement[opt] new-type-id +/// new-initializer[opt] +/// '::'[opt] 'new' new-placement[opt] '(' type-id ')' +/// new-initializer[opt] +/// +/// delete-expression: [C++ 5.3.5] +/// '::'[opt] 'delete' cast-expression +/// '::'[opt] 'delete' '[' ']' cast-expression +/// Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { if (getLang().CPlusPlus) { // Annotate typenames and C++ scope specifiers. @@ -614,6 +626,13 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { Res = ParseCXXIdExpression(); return ParsePostfixExpressionSuffix(Res); + case tok::kw_new: // [C++] new-expression + // FIXME: ParseCXXIdExpression currently steals :: tokens. + return ParseCXXNewExpression(); + + case tok::kw_delete: // [C++] delete-expression + return ParseCXXDeleteExpression(); + case tok::at: { SourceLocation AtLoc = ConsumeToken(); return ParseObjCAtExpression(AtLoc); |

