forked from OSchip/llvm-project
Use PushConditionalTempDestruction/PopConditionalTempDestruction for the ternary operator.
llvm-svn: 72842
This commit is contained in:
parent
f47a3de83c
commit
43c52cdc29
|
@ -263,17 +263,21 @@ void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) {
|
|||
llvm::Value *Cond = CGF.EvaluateExprAsBool(E->getCond());
|
||||
Builder.CreateCondBr(Cond, LHSBlock, RHSBlock);
|
||||
|
||||
CGF.PushConditionalTempDestruction();
|
||||
CGF.EmitBlock(LHSBlock);
|
||||
|
||||
// Handle the GNU extension for missing LHS.
|
||||
assert(E->getLHS() && "Must have LHS for aggregate value");
|
||||
|
||||
Visit(E->getLHS());
|
||||
CGF.PopConditionalTempDestruction();
|
||||
CGF.EmitBranch(ContBlock);
|
||||
|
||||
CGF.PushConditionalTempDestruction();
|
||||
CGF.EmitBlock(RHSBlock);
|
||||
|
||||
Visit(E->getRHS());
|
||||
CGF.PopConditionalTempDestruction();
|
||||
CGF.EmitBranch(ContBlock);
|
||||
|
||||
CGF.EmitBlock(ContBlock);
|
||||
|
|
|
@ -1452,7 +1452,8 @@ VisitConditionalOperator(const ConditionalOperator *E) {
|
|||
CGF.getContext().BoolTy);
|
||||
Builder.CreateCondBr(CondBoolVal, LHSBlock, RHSBlock);
|
||||
}
|
||||
|
||||
|
||||
CGF.PushConditionalTempDestruction();
|
||||
CGF.EmitBlock(LHSBlock);
|
||||
|
||||
// Handle the GNU extension for missing LHS.
|
||||
|
@ -1462,12 +1463,15 @@ VisitConditionalOperator(const ConditionalOperator *E) {
|
|||
else // Perform promotions, to handle cases like "short ?: int"
|
||||
LHS = EmitScalarConversion(CondVal, E->getCond()->getType(), E->getType());
|
||||
|
||||
CGF.PopConditionalTempDestruction();
|
||||
LHSBlock = Builder.GetInsertBlock();
|
||||
CGF.EmitBranch(ContBlock);
|
||||
|
||||
CGF.PushConditionalTempDestruction();
|
||||
CGF.EmitBlock(RHSBlock);
|
||||
|
||||
Value *RHS = Visit(E->getRHS());
|
||||
CGF.PopConditionalTempDestruction();
|
||||
RHSBlock = Builder.GetInsertBlock();
|
||||
CGF.EmitBranch(ContBlock);
|
||||
|
||||
|
|
Loading…
Reference in New Issue