Centralize basic block creation in CodeGenFunction::createBasicBlock.
 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59017 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index e12a68b4..3826e76 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -115,8 +115,8 @@
   llvm::Value *nullValue = llvm::Constant::getNullValue(llvm::Type::Int8Ty);
   llvm::Value *ICmp = Builder.CreateICmpEQ(V, nullValue , "tobool");
   
-  llvm::BasicBlock *InitBlock = llvm::BasicBlock::Create("init");
-  llvm::BasicBlock *EndBlock = llvm::BasicBlock::Create("initend");
+  llvm::BasicBlock *InitBlock = createBasicBlock("init");
+  llvm::BasicBlock *EndBlock = createBasicBlock("initend");
 
   // If the guard variable is 0, jump to the initializer code.
   Builder.CreateCondBr(ICmp, InitBlock, EndBlock);
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index e8ab1bb..b713945 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -229,9 +229,9 @@
 }
 
 void AggExprEmitter::VisitConditionalOperator(const ConditionalOperator *E) {
-  llvm::BasicBlock *LHSBlock = llvm::BasicBlock::Create("cond.?");
-  llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("cond.:");
-  llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("cond.cont");
+  llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.?");
+  llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.:");
+  llvm::BasicBlock *ContBlock = CGF.createBasicBlock("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 11bc780..d12d355 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -466,9 +466,9 @@
 
 ComplexPairTy ComplexExprEmitter::
 VisitConditionalOperator(const ConditionalOperator *E) {
-  llvm::BasicBlock *LHSBlock = llvm::BasicBlock::Create("cond.?");
-  llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("cond.:");
-  llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("cond.cont");
+  llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.?");
+  llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.:");
+  llvm::BasicBlock *ContBlock = CGF.createBasicBlock("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 a4c65c0..7d3157b 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1055,8 +1055,8 @@
 Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
   Value *LHSCond = CGF.EvaluateExprAsBool(E->getLHS());
   
-  llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("lor_cont");
-  llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("lor_rhs");
+  llvm::BasicBlock *ContBlock = CGF.createBasicBlock("lor_cont");
+  llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("lor_rhs");
   
   llvm::BasicBlock *OrigBlock = Builder.GetInsertBlock();
   Builder.CreateCondBr(LHSCond, ContBlock, RHSBlock);
@@ -1090,9 +1090,9 @@
 
 Value *ScalarExprEmitter::
 VisitConditionalOperator(const ConditionalOperator *E) {
-  llvm::BasicBlock *LHSBlock = llvm::BasicBlock::Create("cond.?");
-  llvm::BasicBlock *RHSBlock = llvm::BasicBlock::Create("cond.:");
-  llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("cond.cont");
+  llvm::BasicBlock *LHSBlock = CGF.createBasicBlock("cond.?");
+  llvm::BasicBlock *RHSBlock = CGF.createBasicBlock("cond.:");
+  llvm::BasicBlock *ContBlock = CGF.createBasicBlock("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/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index cb82040..9079284 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -389,9 +389,8 @@
   llvm::Value *LimitPtr = CreateTempAlloca(UnsignedLongLTy, "limit.ptr");
   Builder.CreateStore(CountRV.getScalarVal(), LimitPtr);
   
-  llvm::BasicBlock *NoElements = llvm::BasicBlock::Create("noelements");
-  llvm::BasicBlock *SetStartMutations = 
-    llvm::BasicBlock::Create("setstartmutations");
+  llvm::BasicBlock *NoElements = createBasicBlock("noelements");
+  llvm::BasicBlock *SetStartMutations = createBasicBlock("setstartmutations");
   
   llvm::Value *Limit = Builder.CreateLoad(LimitPtr);
   llvm::Value *Zero = llvm::Constant::getNullValue(UnsignedLongLTy);
@@ -414,13 +413,13 @@
   
   Builder.CreateStore(StateMutations, StartMutationsPtr);
   
-  llvm::BasicBlock *LoopStart = llvm::BasicBlock::Create("loopstart");
+  llvm::BasicBlock *LoopStart = createBasicBlock("loopstart");
   EmitBlock(LoopStart);
 
   llvm::Value *CounterPtr = CreateTempAlloca(UnsignedLongLTy, "counter.ptr");
   Builder.CreateStore(Zero, CounterPtr);
   
-  llvm::BasicBlock *LoopBody = llvm::BasicBlock::Create("loopbody"); 
+  llvm::BasicBlock *LoopBody = createBasicBlock("loopbody"); 
   EmitBlock(LoopBody);
 
   StateMutationsPtr = Builder.CreateLoad(StateMutationsPtrPtr, "mutationsptr");
@@ -433,8 +432,8 @@
                                                      "tobool");
   
   
-  llvm::BasicBlock *WasMutated = llvm::BasicBlock::Create("wasmutated");
-  llvm::BasicBlock *WasNotMutated = llvm::BasicBlock::Create("wasnotmutated");
+  llvm::BasicBlock *WasMutated = createBasicBlock("wasmutated");
+  llvm::BasicBlock *WasNotMutated = createBasicBlock("wasnotmutated");
   
   Builder.CreateCondBr(MutationsEqual, WasNotMutated, WasMutated);
   
@@ -477,8 +476,8 @@
                               llvm::ConstantInt::get(UnsignedLongLTy, 1));
   Builder.CreateStore(Counter, CounterPtr);
   
-  llvm::BasicBlock *LoopEnd = llvm::BasicBlock::Create("loopend");
-  llvm::BasicBlock *AfterBody = llvm::BasicBlock::Create("afterbody");
+  llvm::BasicBlock *LoopEnd = createBasicBlock("loopend");
+  llvm::BasicBlock *AfterBody = createBasicBlock("afterbody");
   
   BreakContinueStack.push_back(BreakContinue(LoopEnd, AfterBody));
 
@@ -488,7 +487,7 @@
   
   EmitBlock(AfterBody);
   
-  llvm::BasicBlock *FetchMore = llvm::BasicBlock::Create("fetchmore");
+  llvm::BasicBlock *FetchMore = createBasicBlock("fetchmore");
   
   llvm::Value *IsLess = Builder.CreateICmpULT(Counter, Limit, "isless");
   Builder.CreateCondBr(IsLess, LoopBody, FetchMore);
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 4ac6260..34f9952 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -1523,16 +1523,16 @@
 void CGObjCMac::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
                             const ObjCAtTryStmt &S) {
   // Create various blocks we refer to for handling @finally.
-  llvm::BasicBlock *FinallyBlock = llvm::BasicBlock::Create("finally");
-  llvm::BasicBlock *FinallyNoExit = llvm::BasicBlock::Create("finally.noexit");
-  llvm::BasicBlock *FinallyRethrow = llvm::BasicBlock::Create("finally.throw");
-  llvm::BasicBlock *FinallyEnd = llvm::BasicBlock::Create("finally.end");
+  llvm::BasicBlock *FinallyBlock = CGF.createBasicBlock("finally");
+  llvm::BasicBlock *FinallyNoExit = CGF.createBasicBlock("finally.noexit");
+  llvm::BasicBlock *FinallyRethrow = CGF.createBasicBlock("finally.throw");
+  llvm::BasicBlock *FinallyEnd = CGF.createBasicBlock("finally.end");
   llvm::Value *DestCode = 
     CGF.CreateTempAlloca(llvm::Type::Int32Ty, "finally.dst");
 
   // Generate jump code. Done here so we can directly add things to
   // the switch instruction.
-  llvm::BasicBlock *FinallyJump = llvm::BasicBlock::Create("finally.jump");
+  llvm::BasicBlock *FinallyJump = CGF.createBasicBlock("finally.jump");
   llvm::SwitchInst *FinallySwitch = 
     llvm::SwitchInst::Create(new llvm::LoadInst(DestCode, "", FinallyJump), 
                              FinallyEnd, 10, FinallyJump);
@@ -1557,8 +1557,8 @@
   llvm::Value *SetJmpResult = CGF.Builder.CreateCall(ObjCTypes.SetJmpFn,
                                                      JmpBufPtr, "result");
 
-  llvm::BasicBlock *TryBlock = llvm::BasicBlock::Create("try");
-  llvm::BasicBlock *TryHandler = llvm::BasicBlock::Create("try.handler");
+  llvm::BasicBlock *TryBlock = CGF.createBasicBlock("try");
+  llvm::BasicBlock *TryHandler = CGF.createBasicBlock("try.handler");
   CGF.Builder.CreateCondBr(CGF.Builder.CreateIsNotNull(SetJmpResult, "threw"), 
                            TryHandler, TryBlock);
 
@@ -1585,8 +1585,8 @@
                                                        JmpBufPtr, "result");
     llvm::Value *Threw = CGF.Builder.CreateIsNotNull(SetJmpResult, "threw");
 
-    llvm::BasicBlock *CatchBlock = llvm::BasicBlock::Create("catch");
-    llvm::BasicBlock *CatchHandler = llvm::BasicBlock::Create("catch.handler");
+    llvm::BasicBlock *CatchBlock = CGF.createBasicBlock("catch");
+    llvm::BasicBlock *CatchHandler = CGF.createBasicBlock("catch.handler");
     CGF.Builder.CreateCondBr(Threw, CatchHandler, CatchBlock);
     
     CGF.EmitBlock(CatchBlock);
@@ -1596,7 +1596,7 @@
     // so.
     bool AllMatched = false;
     for (; CatchStmt; CatchStmt = CatchStmt->getNextCatchStmt()) {
-      llvm::BasicBlock *NextCatchBlock = llvm::BasicBlock::Create("catch");
+      llvm::BasicBlock *NextCatchBlock = CGF.createBasicBlock("catch");
 
       const DeclStmt *CatchParam = 
         cast_or_null<DeclStmt>(CatchStmt->getCatchParamStmt());
@@ -1640,7 +1640,7 @@
       llvm::Value *Match = CGF.Builder.CreateCall2(ObjCTypes.ExceptionMatchFn,
                                                    Class, Caught, "match");
       
-      llvm::BasicBlock *MatchedBlock = llvm::BasicBlock::Create("matched");
+      llvm::BasicBlock *MatchedBlock = CGF.createBasicBlock("matched");
       
       CGF.Builder.CreateCondBr(CGF.Builder.CreateIsNotNull(Match, "matched"), 
                                MatchedBlock, NextCatchBlock);
@@ -1717,7 +1717,7 @@
   
   CGF.Builder.CreateCall(ObjCTypes.ExceptionThrowFn, ExceptionAsObject);
   CGF.Builder.CreateUnreachable();
-  CGF.EmitBlock(llvm::BasicBlock::Create("bb"));
+  CGF.EmitBlock(CGF.createBasicBlock("bb"));
 }
 
 void CodeGenFunction::EmitJumpThroughFinally(ObjCEHEntry *E,
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index a9a7a01..232781e 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -189,7 +189,7 @@
   
   // Emit a block after the branch so that dead code after a goto has some place
   // to go.
-  Builder.SetInsertPoint(llvm::BasicBlock::Create("", CurFn));
+  Builder.SetInsertPoint(createBasicBlock("", CurFn));
 }
 
 void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) {
@@ -210,7 +210,7 @@
 
   // Emit a block after the branch so that dead code after a goto has some place
   // to go.
-  Builder.SetInsertPoint(llvm::BasicBlock::Create("", CurFn));
+  Builder.SetInsertPoint(createBasicBlock("", CurFn));
 }
 
 void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
@@ -221,12 +221,12 @@
   // unequal to 0.  The condition must be a scalar type.
   llvm::Value *BoolCondVal = EvaluateExprAsBool(S.getCond());
   
-  llvm::BasicBlock *ContBlock = llvm::BasicBlock::Create("ifend");
-  llvm::BasicBlock *ThenBlock = llvm::BasicBlock::Create("ifthen");
+  llvm::BasicBlock *ContBlock = createBasicBlock("ifend");
+  llvm::BasicBlock *ThenBlock = createBasicBlock("ifthen");
   llvm::BasicBlock *ElseBlock = ContBlock;
   
   if (S.getElse())
-    ElseBlock = llvm::BasicBlock::Create("ifelse");
+    ElseBlock = createBasicBlock("ifelse");
   
   // Insert the conditional branch.
   Builder.CreateCondBr(BoolCondVal, ThenBlock, ElseBlock);
@@ -262,7 +262,7 @@
 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 = llvm::BasicBlock::Create("whilecond");
+  llvm::BasicBlock *LoopHeader = createBasicBlock("whilecond");
   EmitBlock(LoopHeader);
   
   // Evaluate the conditional in the while header.  C99 6.8.5.1: The evaluation
@@ -279,8 +279,8 @@
   
   // Create an exit block for when the condition fails, create a block for the
   // body of the loop.
-  llvm::BasicBlock *ExitBlock = llvm::BasicBlock::Create("whileexit");
-  llvm::BasicBlock *LoopBody  = llvm::BasicBlock::Create("whilebody");
+  llvm::BasicBlock *ExitBlock = createBasicBlock("whileexit");
+  llvm::BasicBlock *LoopBody  = createBasicBlock("whilebody");
   
   // As long as the condition is true, go to the loop body.
   if (EmitBoolCondBranch)
@@ -313,11 +313,11 @@
 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 = llvm::BasicBlock::Create("dobody");
-  llvm::BasicBlock *AfterDo = llvm::BasicBlock::Create("afterdo");
+  llvm::BasicBlock *LoopBody = createBasicBlock("dobody");
+  llvm::BasicBlock *AfterDo = createBasicBlock("afterdo");
   EmitBlock(LoopBody);
 
-  llvm::BasicBlock *DoCond = llvm::BasicBlock::Create("docond");
+  llvm::BasicBlock *DoCond = createBasicBlock("docond");
   
   // Store the blocks to use for break and continue.
   BreakContinueStack.push_back(BreakContinue(AfterDo, DoCond));
@@ -371,8 +371,8 @@
     EmitStmt(S.getInit());
 
   // Start the loop with a block that tests the condition.
-  llvm::BasicBlock *CondBlock = llvm::BasicBlock::Create("forcond");
-  llvm::BasicBlock *AfterFor = llvm::BasicBlock::Create("afterfor");
+  llvm::BasicBlock *CondBlock = createBasicBlock("forcond");
+  llvm::BasicBlock *AfterFor = createBasicBlock("afterfor");
 
   EmitBlock(CondBlock);
 
@@ -384,7 +384,7 @@
     llvm::Value *BoolCondVal = EvaluateExprAsBool(S.getCond());
     
     // As long as the condition is true, iterate the loop.
-    llvm::BasicBlock *ForBody = llvm::BasicBlock::Create("forbody");
+    llvm::BasicBlock *ForBody = createBasicBlock("forbody");
     Builder.CreateCondBr(BoolCondVal, ForBody, AfterFor);
     EmitBlock(ForBody);    
   } else {
@@ -396,7 +396,7 @@
   // condition as the continue block.
   llvm::BasicBlock *ContinueBlock;
   if (S.getInc())
-    ContinueBlock = llvm::BasicBlock::Create("forinc");
+    ContinueBlock = createBasicBlock("forinc");
   else
     ContinueBlock = CondBlock;  
   
@@ -433,7 +433,7 @@
 
   // Emit a block after the branch so that dead code after a return has some
   // place to go.
-  EmitBlock(llvm::BasicBlock::Create());
+  EmitBlock(createBasicBlock());
 }
 
 /// EmitReturnStmt - Note that due to GCC extensions, this can have an operand
@@ -463,7 +463,7 @@
   if (!ObjCEHStack.empty()) {
     for (ObjCEHStackType::reverse_iterator i = ObjCEHStack.rbegin(), 
            e = ObjCEHStack.rend(); i != e; ++i) {
-      llvm::BasicBlock *ReturnPad = llvm::BasicBlock::Create("return.pad");
+      llvm::BasicBlock *ReturnPad = createBasicBlock("return.pad");
       EmitJumpThroughFinally(*i, ReturnPad);
       EmitBlock(ReturnPad);
     }
@@ -473,7 +473,7 @@
   
   // Emit a block after the branch so that dead code after a return has some
   // place to go.
-  EmitBlock(llvm::BasicBlock::Create());
+  EmitBlock(createBasicBlock());
 }
 
 void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
@@ -487,7 +487,7 @@
 
   llvm::BasicBlock *Block = BreakContinueStack.back().BreakBlock;
   Builder.CreateBr(Block);
-  EmitBlock(llvm::BasicBlock::Create());
+  EmitBlock(createBasicBlock());
 }
 
 void CodeGenFunction::EmitContinueStmt() {
@@ -495,7 +495,7 @@
 
   llvm::BasicBlock *Block = BreakContinueStack.back().ContinueBlock;
   Builder.CreateBr(Block);
-  EmitBlock(llvm::BasicBlock::Create());
+  EmitBlock(createBasicBlock());
 }
 
 /// EmitCaseStmtRange - If case statement range is not too big then
@@ -537,7 +537,7 @@
   // in the default basic block). The switch's default will be changed
   // to the top of this chain after switch emission is complete.
   llvm::BasicBlock *FalseDest = CaseRangeBlock;
-  CaseRangeBlock = llvm::BasicBlock::Create("sw.caserange");
+  CaseRangeBlock = createBasicBlock("sw.caserange");
 
   CurFn->getBasicBlockList().push_back(CaseRangeBlock);
   Builder.SetInsertPoint(CaseRangeBlock);
@@ -563,14 +563,14 @@
   StartBlock("sw.bb");
   llvm::BasicBlock *CaseDest = Builder.GetInsertBlock();
   llvm::APSInt CaseVal = S.getLHS()->getIntegerConstantExprValue(getContext());
-  SwitchInsn->addCase(llvm::ConstantInt::get(CaseVal), 
-                      CaseDest);
+  SwitchInsn->addCase(llvm::ConstantInt::get(CaseVal), CaseDest);
   EmitStmt(S.getSubStmt());
 }
 
 void CodeGenFunction::EmitDefaultStmt(const DefaultStmt &S) {
   llvm::BasicBlock *DefaultBlock = SwitchInsn->getDefaultDest();
-  assert(DefaultBlock->empty() && "EmitDefaultStmt: Default block already defined?");
+  assert(DefaultBlock->empty() && 
+         "EmitDefaultStmt: Default block already defined?");
   EmitBlock(DefaultBlock);
   EmitStmt(S.getSubStmt());
 }
@@ -586,8 +586,8 @@
   // statement. We also need to create a default block now so that
   // explicit case ranges tests can have a place to jump to on
   // failure.
-  llvm::BasicBlock *NextBlock = llvm::BasicBlock::Create("sw.epilog");
-  llvm::BasicBlock *DefaultBlock = llvm::BasicBlock::Create("sw.default");
+  llvm::BasicBlock *NextBlock = createBasicBlock("sw.epilog");
+  llvm::BasicBlock *DefaultBlock = createBasicBlock("sw.default");
   SwitchInsn = Builder.CreateSwitch(CondV, DefaultBlock);
   CaseRangeBlock = DefaultBlock;
 
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index c4a33245..f66c6ea 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -38,7 +38,7 @@
   if (BB) return BB;
   
   // Create, but don't insert, the new block.
-  return BB = llvm::BasicBlock::Create(S->getName());
+  return BB = createBasicBlock(S->getName());
 }
 
 llvm::Constant *
@@ -98,7 +98,7 @@
   CurFn = Fn;
   assert(CurFn->isDeclaration() && "Function already has body?");
 
-  llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", CurFn);
+  llvm::BasicBlock *EntryBB = createBasicBlock("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
@@ -107,7 +107,7 @@
   AllocaInsertPt = new llvm::BitCastInst(Undef, llvm::Type::Int32Ty, "allocapt",
                                          EntryBB);
 
-  ReturnBlock = llvm::BasicBlock::Create("return");
+  ReturnBlock = createBasicBlock("return");
   ReturnValue = 0;
   if (!RetTy->isVoidType())
     ReturnValue = CreateTempAlloca(ConvertType(RetTy), "retval");
@@ -168,7 +168,7 @@
 void CodeGenFunction::StartBlock(const char *N) {
   llvm::BasicBlock *BB = Builder.GetInsertBlock();
   if (!isDummyBlock(BB))
-    EmitBlock(llvm::BasicBlock::Create(N));
+    EmitBlock(createBasicBlock(N));
   else
     BB->setName(N);
 }
@@ -225,7 +225,7 @@
   } else {
     // No possible targets for indirect goto, just emit an infinite
     // loop.
-    Default = llvm::BasicBlock::Create("indirectgoto.loop", CurFn);
+    Default = createBasicBlock("indirectgoto.loop", CurFn);
     llvm::BranchInst::Create(Default, Default);
   }
 
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index e6636ba..c9dcaa7 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -212,12 +212,18 @@
   /// hasAggregateLLVMType - Return true if the specified AST type will map into
   /// an aggregate LLVM type or is void.
   static bool hasAggregateLLVMType(QualType T);
-  
+
+  /// createBasicBlock - Create an LLVM basic block.
+  llvm::BasicBlock *createBasicBlock(const char *Name="", 
+                                     llvm::Function *Parent=0,
+                                     llvm::BasicBlock *InsertBefore=0) {
+    return llvm::BasicBlock::Create(Name, Parent, InsertBefore);
+  }
+                                    
   /// getBasicBlockForLabel - Return the LLVM basicblock that the specified
   /// label maps to.
   llvm::BasicBlock *getBasicBlockForLabel(const LabelStmt *S);
   
-  
   void EmitBlock(llvm::BasicBlock *BB);
   
   /// ErrorUnsupported - Print out an error that codegen doesn't support the