]> granicus.if.org Git - clang/commitdiff
Use PushConditionalTempDestruction/PopConditionalTempDestruction for the ternary...
authorAnders Carlsson <andersca@mac.com>
Thu, 4 Jun 2009 03:00:32 +0000 (03:00 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 4 Jun 2009 03:00:32 +0000 (03:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72842 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprScalar.cpp

index 8d903d9198fc2b9b48d28af24a1f99ce0f4d390c..4268ae3b1701496814e4e5e14edc326246830b11 100644 (file)
@@ -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);
index faa4f7611d0de6303c4e587253b104392afc0cd1..ed18d3247ac675251a01db1f47613cf45a6c4a66 100644 (file)
@@ -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);