summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprComplex.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-16 23:07:28 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-16 23:07:28 +0000
commit4f29b49de11e5815952c256bbe66ffe33f4e3d00 (patch)
tree385c3333a9c286d7b56336b5481a8652f2a74cbb /clang/lib/CodeGen/CGExprComplex.cpp
parentaeb5e6677269d0834b494eb5a2374097ec863f12 (diff)
downloadbcm5719-llvm-4f29b49de11e5815952c256bbe66ffe33f4e3d00.tar.gz
bcm5719-llvm-4f29b49de11e5815952c256bbe66ffe33f4e3d00.zip
Support compound complex operations as l-values in C++. Add a test
case based on CodeGen/volatile-1.c which tests the current C++ semantics, and note the many, many places we fall short of them. llvm-svn: 119402
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprComplex.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index df65d5a3ac9..26bda79898b 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -760,3 +760,26 @@ ComplexPairTy CodeGenFunction::LoadComplexFromAddr(llvm::Value *SrcAddr,
bool SrcIsVolatile) {
return ComplexExprEmitter(*this).EmitLoadOfComplex(SrcAddr, SrcIsVolatile);
}
+
+LValue CodeGenFunction::EmitComplexAssignmentLValue(const BinaryOperator *E) {
+ ComplexPairTy Val; // ignored
+
+ ComplexPairTy(ComplexExprEmitter::*Op)(const ComplexExprEmitter::BinOpInfo &);
+
+ switch (E->getOpcode()) {
+ case BO_Assign:
+ return ComplexExprEmitter(*this).EmitBinAssignLValue(E, Val);
+
+ case BO_MulAssign: Op = &ComplexExprEmitter::EmitBinMul; break;
+ case BO_DivAssign: Op = &ComplexExprEmitter::EmitBinDiv; break;
+ case BO_SubAssign: Op = &ComplexExprEmitter::EmitBinSub; break;
+ case BO_AddAssign: Op = &ComplexExprEmitter::EmitBinAdd; break;
+
+ default:
+ llvm_unreachable("unexpected complex compound assignment");
+ Op = 0;
+ }
+
+ return ComplexExprEmitter(*this).EmitCompoundAssignLValue(
+ cast<CompoundAssignOperator>(E), Op, Val);
+}
OpenPOWER on IntegriCloud