X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2Ftutorial%2FLangImpl6.html;h=39febee653924252f130c6c32f0c64fb5df80ece;hb=6fa1c051dc515b6fd1f9a26ac12fed985469bff5;hp=1f159e0b56d51fd88b38e2a76abee653af17e1ff;hpb=89f6d88db334ba088672ae0753deb7d7b7509bac;p=oota-llvm.git diff --git a/docs/tutorial/LangImpl6.html b/docs/tutorial/LangImpl6.html index 1f159e0b56d..39febee6539 100644 --- a/docs/tutorial/LangImpl6.html +++ b/docs/tutorial/LangImpl6.html @@ -321,7 +321,7 @@ Function *FunctionAST::Codegen() { BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence(); // Create a new basic block to start insertion into. - BasicBlock *BB = new BasicBlock("entry", TheFunction); + BasicBlock *BB = BasicBlock::Create("entry", TheFunction); Builder.SetInsertPoint(BB); if (Value *RetVal = Body->Codegen()) { @@ -1085,7 +1085,7 @@ static ExprAST *ParseIdentifierExpr() { if (CurTok == ')') break; if (CurTok != ',') - return Error("Expected ')'"); + return Error("Expected ')' or ',' in argument list"); getNextToken(); } } @@ -1364,7 +1364,7 @@ static FunctionPassManager *TheFPM; Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return ConstantFP::get(Type::DoubleTy, APFloat(Val)); + return ConstantFP::get(APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1435,16 +1435,16 @@ Value *IfExprAST::Codegen() { // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); // Create blocks for the then and else cases. Insert the 'then' block at the // end of the function. - BasicBlock *ThenBB = new BasicBlock("then", TheFunction); - BasicBlock *ElseBB = new BasicBlock("else"); - BasicBlock *MergeBB = new BasicBlock("ifcont"); + BasicBlock *ThenBB = BasicBlock::Create("then", TheFunction); + BasicBlock *ElseBB = BasicBlock::Create("else"); + BasicBlock *MergeBB = BasicBlock::Create("ifcont"); Builder.CreateCondBr(CondV, ThenBB, ElseBB); @@ -1504,7 +1504,7 @@ Value *ForExprAST::Codegen() { // block. Function *TheFunction = Builder.GetInsertBlock()->getParent(); BasicBlock *PreheaderBB = Builder.GetInsertBlock(); - BasicBlock *LoopBB = new BasicBlock("loop", TheFunction); + BasicBlock *LoopBB = BasicBlock::Create("loop", TheFunction); // Insert an explicit fall through from the current block to the LoopBB. Builder.CreateBr(LoopBB); @@ -1534,7 +1534,7 @@ Value *ForExprAST::Codegen() { if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0)); + StepVal = ConstantFP::get(APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -1545,12 +1545,12 @@ Value *ForExprAST::Codegen() { // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. BasicBlock *LoopEndBB = Builder.GetInsertBlock(); - BasicBlock *AfterBB = new BasicBlock("afterloop", TheFunction); + BasicBlock *AfterBB = BasicBlock::Create("afterloop", TheFunction); // Insert the conditional branch into the end of LoopEndBB. Builder.CreateCondBr(EndCond, LoopBB, AfterBB); @@ -1577,7 +1577,7 @@ Function *PrototypeAST::Codegen() { std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy); FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false); - Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule); + Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule); // If F conflicted, there was already something named 'Name'. If it has a // body, don't allow redefinition or reextern. @@ -1624,7 +1624,7 @@ Function *FunctionAST::Codegen() { BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence(); // Create a new basic block to start insertion into. - BasicBlock *BB = new BasicBlock("entry", TheFunction); + BasicBlock *BB = BasicBlock::Create("entry", TheFunction); Builder.SetInsertPoint(BB); if (Value *RetVal = Body->Codegen()) {