diff options
| author | Mike Stump <mrs@apple.com> | 2009-05-23 22:01:27 +0000 |
|---|---|---|
| committer | Mike Stump <mrs@apple.com> | 2009-05-23 22:01:27 +0000 |
| commit | 332ec2ce815fed2516279ff739340de9343cb02b (patch) | |
| tree | 4f2871a5bb9adf68010e8ae1a13e078a7ccfc21b /clang/lib/CodeGen | |
| parent | 23abd46b79c711e558b32aff3a91c9e89d732e60 (diff) | |
| download | bcm5719-llvm-332ec2ce815fed2516279ff739340de9343cb02b.tar.gz bcm5719-llvm-332ec2ce815fed2516279ff739340de9343cb02b.zip | |
Fix thinko, and implement aggregate volatile reads.
llvm-svn: 72347
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 951a5f0e396..3b7871390c9 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -131,9 +131,14 @@ void AggExprEmitter::EmitFinalDestCopy(const Expr *E, RValue Src) { assert(Src.isAggregate() && "value must be aggregate value!"); // If the result is ignored, don't copy from the value. - if (DestPtr == 0) - // FIXME: If the source is volatile, we must read from it. - return; + if (DestPtr == 0) { + if (Src.isVolatileQualified()) + // If the source is volatile, we must read from it; to do that, we need + // some place to put it. + DestPtr = CGF.CreateTempAlloca(CGF.ConvertType(E->getType()), "agg.tmp"); + else + return; + } // If the result of the assignment is used, copy the LHS there also. // FIXME: Pass VolatileDest as well. I think we also need to merge volatile @@ -197,7 +202,7 @@ void AggExprEmitter::VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { } void AggExprEmitter::VisitBinComma(const BinaryOperator *E) { - CGF.EmitAnyExprToTemp(E->getLHS(), 0, VolatileDest); + CGF.EmitAnyExpr(E->getLHS()); CGF.EmitAggExpr(E->getRHS(), DestPtr, VolatileDest); } |

