diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-10-19 18:28:22 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-10-19 18:28:22 +0000 |
| commit | 0999aafda58ecd37709199dc6c4430ba53e7ae6a (patch) | |
| tree | f34ed0c6b2ed37053821b764b732fb8deb0b9a36 /clang/lib/CodeGen | |
| parent | 0ed889521be2f4ca459d08ef8b8b6a0711412e07 (diff) | |
| download | bcm5719-llvm-0999aafda58ecd37709199dc6c4430ba53e7ae6a.tar.gz bcm5719-llvm-0999aafda58ecd37709199dc6c4430ba53e7ae6a.zip | |
Handle emitting the assignment operator when the lhs is a reference. Fixes PR5227.
llvm-svn: 84518
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 6542aa50d26..29ca900ed31 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1367,6 +1367,16 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) { if (E->getOpcode() != BinaryOperator::Assign) return EmitUnsupportedLValue(E, "binary l-value expression"); + if (!hasAggregateLLVMType(E->getType())) { + // Emit the LHS as an l-value. + LValue LV = EmitLValue(E->getLHS()); + + llvm::Value *RHS = EmitScalarExpr(E->getRHS()); + EmitStoreOfScalar(RHS, LV.getAddress(), LV.isVolatileQualified(), + E->getType()); + return LV; + } + llvm::Value *Temp = CreateTempAlloca(ConvertType(E->getType())); EmitAggExpr(E, Temp, false); // FIXME: Are these qualifiers correct? |

