aboutsummaryrefslogtreecommitdiff
path: root/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
commit83ce9d4a552987d34cbd500e983db8d770232379 (patch)
tree691cfdcff43a0b22aeeb2d08f0fa7922124f084b /lib/CodeGen/CGExprComplex.cpp
parentbee77f75358a5aaf2e2e01ab9cfd37ffc514ed7a (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprComplex.cpp')
-rw-r--r--lib/CodeGen/CGExprComplex.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index df65d5a3ac..26bda79898 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/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);
+}