From 984d0b414bc76d3530b9bc55a5a55834ba76c607 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Sun, 6 Apr 2008 20:42:52 +0000 Subject: [PATCH] tracking API changes arising from r49277 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49279 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprAgg.cpp | 6 +++--- lib/CodeGen/CGExprComplex.cpp | 6 +++--- lib/CodeGen/CGExprScalar.cpp | 14 ++++++------ lib/CodeGen/CGObjCEtoile.cpp | 2 +- lib/CodeGen/CGObjCGNU.cpp | 2 +- lib/CodeGen/CGStmt.cpp | 38 ++++++++++++++++----------------- lib/CodeGen/CodeGenFunction.cpp | 8 +++---- lib/CodeGen/CodeGenModule.cpp | 6 +++--- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 1ce46ae4b4..3bfcc10f7f 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -238,9 +238,9 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) { } void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) { - llvm::BasicBlock *LHSBlock = new llvm::BasicBlock("cond.?"); - llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("cond.:"); - llvm::BasicBlock *ContBlock = new llvm::BasicBlock("cond.cont"); + llvm::BasicBlock *LHSBlock = llvm::BasicBlock::Create("cond.?"); + llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("cond.:"); + llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("cond.cont"); llvm::Value *Cond = CGF.EvaluateExprAsBool(E->getCond()); Builder.CreateCondBr(Cond, LHSBlock, RHSBlock); diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp index df8d1b404e..1e8c8a37f2 100644 --- a/lib/CodeGen/CGExprComplex.cpp +++ b/lib/CodeGen/CGExprComplex.cpp @@ -455,9 +455,9 @@ ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) { ComplexPairTy ComplexExprEmitter:: VisitConditionalOperator(const ConditionalOperator *E) { - llvm::BasicBlock *LHSBlock = new llvm::BasicBlock("cond.?"); - llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("cond.:"); - llvm::BasicBlock *ContBlock = new llvm::BasicBlock("cond.cont"); + llvm::BasicBlock *LHSBlock = llvm::BasicBlock::Create("cond.?"); + llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("cond.:"); + llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("cond.cont"); llvm::Value *Cond = CGF.EvaluateExprAsBool(E->getCond()); Builder.CreateCondBr(Cond, LHSBlock, RHSBlock); diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index de138a1d6b..89779075a4 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -960,8 +960,8 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) { Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) { Value *LHSCond = CGF.EvaluateExprAsBool(E->getLHS()); - llvm::BasicBlock *ContBlock = new llvm::BasicBlock("land_cont"); - llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("land_rhs"); + llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("land_cont"); + llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("land_rhs"); llvm::BasicBlock *OrigBlock = Builder.GetInsertBlock(); Builder.CreateCondBr(LHSCond, RHSBlock, ContBlock); @@ -987,8 +987,8 @@ Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) { Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) { Value *LHSCond = CGF.EvaluateExprAsBool(E->getLHS()); - llvm::BasicBlock *ContBlock = new llvm::BasicBlock("lor_cont"); - llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("lor_rhs"); + llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("lor_cont"); + llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("lor_rhs"); llvm::BasicBlock *OrigBlock = Builder.GetInsertBlock(); Builder.CreateCondBr(LHSCond, ContBlock, RHSBlock); @@ -1022,9 +1022,9 @@ Value *ScalarExprEmitter::VisitBinComma(const BinaryOperator *E) { Value *ScalarExprEmitter:: VisitConditionalOperator(const ConditionalOperator *E) { - llvm::BasicBlock *LHSBlock = new llvm::BasicBlock("cond.?"); - llvm::BasicBlock *RHSBlock = new llvm::BasicBlock("cond.:"); - llvm::BasicBlock *ContBlock = new llvm::BasicBlock("cond.cont"); + llvm::BasicBlock *LHSBlock = llvm::BasicBlock::Create("cond.?"); + llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("cond.:"); + llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("cond.cont"); // Evaluate the conditional, then convert it to bool. We do this explicitly // because we need the unconverted value if this is a GNU ?: expression with diff --git a/lib/CodeGen/CGObjCEtoile.cpp b/lib/CodeGen/CGObjCEtoile.cpp index e2e7a67558..74c98224ff 100644 --- a/lib/CodeGen/CGObjCEtoile.cpp +++ b/lib/CodeGen/CGObjCEtoile.cpp @@ -231,7 +231,7 @@ llvm::Function *CGObjCEtoile::MethodPreamble( } llvm::FunctionType *MethodTy = llvm::FunctionType::get(ReturnTy, Args, isVarArg); - llvm::Function *Method = new llvm::Function(MethodTy, + llvm::Function *Method = llvm::Function::Create(MethodTy, llvm::GlobalValue::InternalLinkage, ".objc.method", &TheModule); diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index dd0eaa3b7c..9d97d475ca 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/lib/CodeGen/CGObjCGNU.cpp @@ -170,7 +170,7 @@ llvm::Function *CGObjCGNU::MethodPreamble( llvm::FunctionType *MethodTy = llvm::FunctionType::get(ReturnTy, Args, isVarArg); - llvm::Function *Method = new llvm::Function(MethodTy, + llvm::Function *Method = llvm::Function::Create(MethodTy, llvm::GlobalValue::InternalLinkage, ".objc.method", &TheModule); diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 4a41a4962f..8217af987d 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -116,7 +116,7 @@ void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) { // Emit a block after the branch so that dead code after a goto has some place // to go. - Builder.SetInsertPoint(new llvm::BasicBlock("", CurFn)); + Builder.SetInsertPoint(llvm::BasicBlock::Create("", CurFn)); } void CodeGenFunction::EmitIfStmt(const IfStmt &S) { @@ -124,12 +124,12 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { // unequal to 0. The condition must be a scalar type. llvm::Value *BoolCondVal = EvaluateExprAsBool(S.getCond()); - llvm::BasicBlock *ContBlock = new llvm::BasicBlock("ifend"); - llvm::BasicBlock *ThenBlock = new llvm::BasicBlock("ifthen"); + llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("ifend"); + llvm::BasicBlock *ThenBlock = llvm::BasicBlock::Create("ifthen"); llvm::BasicBlock *ElseBlock = ContBlock; if (S.getElse()) - ElseBlock = new llvm::BasicBlock("ifelse"); + ElseBlock = llvm::BasicBlock::Create("ifelse"); // Insert the conditional branch. Builder.CreateCondBr(BoolCondVal, ThenBlock, ElseBlock); @@ -165,7 +165,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { void CodeGenFunction::EmitWhileStmt(const WhileStmt &S) { // Emit the header for the loop, insert it, which will create an uncond br to // it. - llvm::BasicBlock *LoopHeader = new llvm::BasicBlock("whilecond"); + llvm::BasicBlock *LoopHeader = llvm::BasicBlock::Create("whilecond"); EmitBlock(LoopHeader); // Evaluate the conditional in the while header. C99 6.8.5.1: The evaluation @@ -182,8 +182,8 @@ void CodeGenFunction::EmitWhileStmt(const WhileStmt &S) { // Create an exit block for when the condition fails, create a block for the // body of the loop. - llvm::BasicBlock *ExitBlock = new llvm::BasicBlock("whileexit"); - llvm::BasicBlock *LoopBody = new llvm::BasicBlock("whilebody"); + llvm::BasicBlock *ExitBlock = llvm::BasicBlock::Create("whileexit"); + llvm::BasicBlock *LoopBody = llvm::BasicBlock::Create("whilebody"); // As long as the condition is true, go to the loop body. if (EmitBoolCondBranch) @@ -216,11 +216,11 @@ void CodeGenFunction::EmitWhileStmt(const WhileStmt &S) { void CodeGenFunction::EmitDoStmt(const DoStmt &S) { // Emit the body for the loop, insert it, which will create an uncond br to // it. - llvm::BasicBlock *LoopBody = new llvm::BasicBlock("dobody"); - llvm::BasicBlock *AfterDo = new llvm::BasicBlock("afterdo"); + llvm::BasicBlock *LoopBody = llvm::BasicBlock::Create("dobody"); + llvm::BasicBlock *AfterDo = llvm::BasicBlock::Create("afterdo"); EmitBlock(LoopBody); - llvm::BasicBlock *DoCond = new llvm::BasicBlock("docond"); + llvm::BasicBlock *DoCond = llvm::BasicBlock::Create("docond"); // Store the blocks to use for break and continue. BreakContinueStack.push_back(BreakContinue(AfterDo, DoCond)); @@ -274,8 +274,8 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { EmitStmt(S.getInit()); // Start the loop with a block that tests the condition. - llvm::BasicBlock *CondBlock = new llvm::BasicBlock("forcond"); - llvm::BasicBlock *AfterFor = new llvm::BasicBlock("afterfor"); + llvm::BasicBlock *CondBlock = llvm::BasicBlock::Create("forcond"); + llvm::BasicBlock *AfterFor = llvm::BasicBlock::Create("afterfor"); EmitBlock(CondBlock); @@ -287,7 +287,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { llvm::Value *BoolCondVal = EvaluateExprAsBool(S.getCond()); // As long as the condition is true, iterate the loop. - llvm::BasicBlock *ForBody = new llvm::BasicBlock("forbody"); + llvm::BasicBlock *ForBody = llvm::BasicBlock::Create("forbody"); Builder.CreateCondBr(BoolCondVal, ForBody, AfterFor); EmitBlock(ForBody); } else { @@ -299,7 +299,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { // condition as the continue block. llvm::BasicBlock *ContinueBlock; if (S.getInc()) - ContinueBlock = new llvm::BasicBlock("forinc"); + ContinueBlock = llvm::BasicBlock::Create("forinc"); else ContinueBlock = CondBlock; @@ -354,7 +354,7 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { // Emit a block after the branch so that dead code after a return has some // place to go. - EmitBlock(new llvm::BasicBlock()); + EmitBlock(llvm::BasicBlock::Create()); } void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) { @@ -368,7 +368,7 @@ void CodeGenFunction::EmitBreakStmt() { llvm::BasicBlock *Block = BreakContinueStack.back().BreakBlock; Builder.CreateBr(Block); - EmitBlock(new llvm::BasicBlock()); + EmitBlock(llvm::BasicBlock::Create()); } void CodeGenFunction::EmitContinueStmt() { @@ -376,7 +376,7 @@ void CodeGenFunction::EmitContinueStmt() { llvm::BasicBlock *Block = BreakContinueStack.back().ContinueBlock; Builder.CreateBr(Block); - EmitBlock(new llvm::BasicBlock()); + EmitBlock(llvm::BasicBlock::Create()); } /// EmitCaseStmtRange - If case statement range is not too big then @@ -410,7 +410,7 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S) { // The range is too big. Emit "if" condition. llvm::BasicBlock *FalseDest = NULL; - llvm::BasicBlock *CaseDest = new llvm::BasicBlock("sw.bb"); + llvm::BasicBlock *CaseDest = llvm::BasicBlock::Create("sw.bb"); // If we have already seen one case statement range for this switch // instruction then piggy-back otherwise use default block as false @@ -468,7 +468,7 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { // Create basic block to hold stuff that comes after switch statement. // Initially use it to hold DefaultStmt. - llvm::BasicBlock *NextBlock = new llvm::BasicBlock("after.sw"); + llvm::BasicBlock *NextBlock = llvm::BasicBlock::Create("after.sw"); SwitchInsn = Builder.CreateSwitch(CondV, NextBlock); // All break statements jump to NextBlock. If BreakContinueStack is non empty diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index a07eaff305..e1c8d38873 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -38,7 +38,7 @@ llvm::BasicBlock *CodeGenFunction::getBasicBlockForLabel(const LabelStmt *S) { if (BB) return BB; // Create, but don't insert, the new block. - return BB = new llvm::BasicBlock(S->getName()); + return BB = llvm::BasicBlock::Create(S->getName()); } llvm::Constant * @@ -69,7 +69,7 @@ void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) { ParamTypes.begin(), OMD->param_size(), OMD->isVariadic()); - llvm::BasicBlock *EntryBB = new llvm::BasicBlock("entry", CurFn); + llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", CurFn); // Create a marker to make it easy to insert allocas into the entryblock // later. Don't create this with the builder, because we don't want it @@ -188,7 +188,7 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD) { CurFn->setParamAttrs(llvm::PAListPtr::get(&PAWI, 1)); } - llvm::BasicBlock *EntryBB = new llvm::BasicBlock("entry", CurFn); + llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", CurFn); // Create a marker to make it easy to insert allocas into the entryblock // later. Don't create this with the builder, because we don't want it @@ -252,7 +252,7 @@ bool CodeGenFunction::isDummyBlock(const llvm::BasicBlock *BB) { void CodeGenFunction::StartBlock(const char *N) { llvm::BasicBlock *BB = Builder.GetInsertBlock(); if (!isDummyBlock(BB)) - EmitBlock(new llvm::BasicBlock(N)); + EmitBlock(llvm::BasicBlock::Create(N)); else BB->setName(N); } diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 21b372b347..83f661f012 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -149,7 +149,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunctionDecl(const FunctionDecl *D, // If it doesn't already exist, just create and return an entry. if (F == 0) { // FIXME: param attributes for sext/zext etc. - F = new llvm::Function(FTy, llvm::Function::ExternalLinkage, D->getName(), + F = llvm::Function::Create(FTy, llvm::Function::ExternalLinkage, D->getName(), &getModule()); // Set the appropriate calling convention for the Function. @@ -174,7 +174,7 @@ llvm::Constant *CodeGenModule::GetAddrOfFunctionDecl(const FunctionDecl *D, // This happens if there is a prototype for a function (e.g. "int f()") and // then a definition of a different type (e.g. "int f(int x)"). Start by // making a new function of the correct type, RAUW, then steal the name. - llvm::Function *NewFn = new llvm::Function(FTy, + llvm::Function *NewFn = llvm::Function::Create(FTy, llvm::Function::ExternalLinkage, "", &getModule()); NewFn->takeName(F); @@ -399,7 +399,7 @@ llvm::Function *CodeGenModule::getBuiltinLibFunction(unsigned BuiltinID) { } // FIXME: param attributes for sext/zext etc. - return FunctionSlot = new llvm::Function(Ty, llvm::Function::ExternalLinkage, + return FunctionSlot = llvm::Function::Create(Ty, llvm::Function::ExternalLinkage, Name, &getModule()); } -- 2.40.0