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
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 49a4d77..a179af8 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -398,6 +398,11 @@
         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