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 | d08452f60a2731c279f3b845d84a4a8940844d99 (patch) | |
| tree | fef20a1d72fc923018c89ab9a49977455bace01b /clang/lib/AST/Expr.cpp | |
| parent | 3462c8ecdaf8bb18138c2ee2a99b213f7fd7cff9 (diff) | |
| download | bcm5719-llvm-d08452f60a2731c279f3b845d84a4a8940844d99.tar.gz bcm5719-llvm-d08452f60a2731c279f3b845d84a4a8940844d99.zip | |
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.
llvm-svn: 59638
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 5 | 
1 files changed, 5 insertions, 0 deletions
| diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 49a4d777838..a179af8b145 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -398,6 +398,11 @@ Expr::isLvalueResult Expr::isLvalue(ASTContext &Ctx) const {          cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Imag ||          cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Extension)        return cast<UnaryOperator>(this)->getSubExpr()->isLvalue(Ctx);  // GNU. + +    if (Ctx.getLangOptions().CPlusPlus && // C++ [expr.pre.incr]p1 +        (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::PreInc || +         cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::PreDec)) +      return LV_Valid;      break;    case ImplicitCastExprClass:      return cast<ImplicitCastExpr>(this)->isLvalueCast()? LV_Valid  | 

