From bb8976e36e73560f0556a53ebc3fa2ff4d2449f1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 9 Jan 2010 21:44:40 +0000 Subject: implement codegen support for preinc as an lvalue, PR5514. llvm-svn: 93076 --- clang/lib/CodeGen/CGExpr.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CGExpr.cpp') diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 2c2b76f2e43c..5809d1e70d8b 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1120,8 +1120,16 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) { MakeQualifiers(ExprTy)); } case UnaryOperator::PreInc: - case UnaryOperator::PreDec: - return EmitUnsupportedLValue(E, "pre-inc/dec expression"); + case UnaryOperator::PreDec: { + LValue LV = EmitLValue(E->getSubExpr()); + bool isInc = E->getOpcode() == UnaryOperator::PreInc; + + if (E->getType()->isAnyComplexType()) + EmitComplexPrePostIncDec(E, LV, isInc, true/*isPre*/); + else + EmitScalarPrePostIncDec(E, LV, isInc, true/*isPre*/); + return LV; + } } } -- cgit v1.2.3