diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-19 15:42:04 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-19 15:42:04 +0000 |
commit | 74253736184c0717a0649922551bf9d8b6815651 (patch) | |
tree | 49fde4054461edd0563407010d0c4619e2c7e8fa /lib/Parse/ParseExpr.cpp | |
parent | 08b2c3743a29a2dddcf72e95f747760e213cdde7 (diff) |
Added operator overloading for unary operators, post-increment, and
post-decrement, including support for generating all of the built-in
operator candidates for these operators.
C++ and C have different rules for the arguments to the builtin unary
'+' and '-'. Implemented both variants in Sema::ActOnUnaryOp.
In C++, pre-increment and pre-decrement return lvalues. Update
Expr::isLvalue accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index 2b803d9ad0..440393dac6 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -515,7 +515,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { SourceLocation SavedLoc = ConsumeToken(); Res = ParseCastExpression(true); if (!Res.isInvalid) - Res = Actions.ActOnUnaryOp(SavedLoc, SavedKind, Res.Val); + Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.Val); return Res; } case tok::amp: // unary-expression: '&' cast-expression @@ -529,7 +529,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { SourceLocation SavedLoc = ConsumeToken(); Res = ParseCastExpression(false); if (!Res.isInvalid) - Res = Actions.ActOnUnaryOp(SavedLoc, SavedKind, Res.Val); + Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.Val); return Res; } @@ -539,7 +539,7 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) { SourceLocation SavedLoc = ConsumeToken(); Res = ParseCastExpression(false); if (!Res.isInvalid) - Res = Actions.ActOnUnaryOp(SavedLoc, SavedKind, Res.Val); + Res = Actions.ActOnUnaryOp(CurScope, SavedLoc, SavedKind, Res.Val); return Res; } case tok::kw_sizeof: // unary-expression: 'sizeof' unary-expression @@ -724,8 +724,8 @@ Parser::ExprResult Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { case tok::plusplus: // postfix-expression: postfix-expression '++' case tok::minusminus: // postfix-expression: postfix-expression '--' if (!LHS.isInvalid) - LHS = Actions.ActOnPostfixUnaryOp(Tok.getLocation(), Tok.getKind(), - LHS.Val); + LHS = Actions.ActOnPostfixUnaryOp(CurScope, Tok.getLocation(), + Tok.getKind(), LHS.Val); ConsumeToken(); break; } |