summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprComplex.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-12-05 02:00:02 +0000
committerJohn McCall <rjmccall@apple.com>2010-12-05 02:00:02 +0000
commita2342eb8574e4f5ef455424a02c24feb8ce8b2a1 (patch)
tree05648d6f71d06f249dff5f424f1b2e7239a8dc28 /clang/lib/CodeGen/CGExprComplex.cpp
parent77a11c6174d506f4adfb10a5e4d38606244dad69 (diff)
downloadbcm5719-llvm-a2342eb8574e4f5ef455424a02c24feb8ce8b2a1.tar.gz
bcm5719-llvm-a2342eb8574e4f5ef455424a02c24feb8ce8b2a1.zip
Fix a bug in the emission of __real/__imag l-values on scalar operands.
Fix a bug in the emission of complex compound assignment l-values. Introduce a method to emit an expression whose value isn't relevant. Make that method evaluate its operand as an l-value if it is one. Fixes our volatile compliance in C++. llvm-svn: 120931
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprComplex.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index 28f324b1b28..89a3a26ed61 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -634,7 +634,7 @@ ComplexPairTy ComplexExprEmitter::VisitBinAssign(const BinaryOperator *E) {
}
ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) {
- CGF.EmitStmt(E->getLHS());
+ CGF.EmitIgnoredExpr(E->getLHS());
CGF.EnsureInsertPoint();
return Visit(E->getRHS());
}
@@ -764,14 +764,15 @@ ComplexPairTy CodeGenFunction::LoadComplexFromAddr(llvm::Value *SrcAddr,
}
LValue CodeGenFunction::EmitComplexAssignmentLValue(const BinaryOperator *E) {
+ assert(E->getOpcode() == BO_Assign);
ComplexPairTy Val; // ignored
+ return ComplexExprEmitter(*this).EmitBinAssignLValue(E, Val);
+}
+LValue CodeGenFunction::
+EmitComplexCompoundAssignmentLValue(const CompoundAssignOperator *E) {
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;
@@ -782,6 +783,6 @@ LValue CodeGenFunction::EmitComplexAssignmentLValue(const BinaryOperator *E) {
Op = 0;
}
- return ComplexExprEmitter(*this).EmitCompoundAssignLValue(
- cast<CompoundAssignOperator>(E), Op, Val);
+ ComplexPairTy Val; // ignored
+ return ComplexExprEmitter(*this).EmitCompoundAssignLValue(E, Op, Val);
}
OpenPOWER on IntegriCloud