From 83ce9d4a552987d34cbd500e983db8d770232379 Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 16 Nov 2010 23:07:28 +0000 Subject: 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 --- lib/CodeGen/CGExprComplex.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/CodeGen/CGExprComplex.cpp') 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(E), Op, Val); +} -- cgit v1.2.3