summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-09 21:44:40 +0000
committerChris Lattner <sabre@nondot.org>2010-01-09 21:44:40 +0000
commitbb8976e36e73560f0556a53ebc3fa2ff4d2449f1 (patch)
tree25caaf51bc66ad2414c4c65e4149ad0728507e2f /clang/lib
parent116ce8f1729a074419b985fe9ca6be715ecc7ac9 (diff)
downloadbcm5719-llvm-bb8976e36e73560f0556a53ebc3fa2ff4d2449f1.tar.gz
bcm5719-llvm-bb8976e36e73560f0556a53ebc3fa2ff4d2449f1.zip
implement codegen support for preinc as an lvalue, PR5514.
llvm-svn: 93076
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 2c2b76f2e43..5809d1e70d8 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;
+ }
}
}
OpenPOWER on IntegriCloud