diff options
author | John McCall <rjmccall@apple.com> | 2010-11-17 00:07:33 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-11-17 00:07:33 +0000 |
commit | 5b26f65b3d63cf230f20c0e6bff4bc6253032f70 (patch) | |
tree | 63d2dc9bdffaf33d3a5d79175ea3b57e8d870920 /clang/lib/CodeGen/CGExprAgg.cpp | |
parent | bbb7d625462419dd7a576034abcb52fc9b44628f (diff) | |
download | bcm5719-llvm-5b26f65b3d63cf230f20c0e6bff4bc6253032f70.tar.gz bcm5719-llvm-5b26f65b3d63cf230f20c0e6bff4bc6253032f70.zip |
Reset the lifetime-managed flag between emission of the agg conditional
branches. Fixes PR8623.
llvm-svn: 119408
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 00cfb214472..308520aadd4 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -394,8 +394,8 @@ void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) { CGF.BeginConditionalBranch(); CGF.EmitBlock(LHSBlock); - // Handle the GNU extension for missing LHS. - assert(E->getLHS() && "Must have LHS for aggregate value"); + // Save whether the destination's lifetime is externally managed. + bool DestLifetimeManaged = Dest.isLifetimeExternallyManaged(); Visit(E->getLHS()); CGF.EndConditionalBranch(); @@ -404,6 +404,12 @@ void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) { CGF.BeginConditionalBranch(); CGF.EmitBlock(RHSBlock); + // If the result of an agg expression is unused, then the emission + // of the LHS might need to create a destination slot. That's fine + // with us, and we can safely emit the RHS into the same slot, but + // we shouldn't claim that its lifetime is externally managed. + Dest.setLifetimeExternallyManaged(DestLifetimeManaged); + Visit(E->getRHS()); CGF.EndConditionalBranch(); CGF.EmitBranch(ContBlock); |