Delete the Module object.
[oota-llvm.git] / docs / tutorial / LangImpl3.html
index 47e178397a876a9a086e08ab86fa38d57f26f5db..f77f8f83032ca927e6f3815695301842b35ead66 100644 (file)
@@ -306,7 +306,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);
 </pre>
 </div>
 
@@ -327,7 +327,7 @@ don't "new" a type, you "get" it.</p>
 
 <p>The final line above actually creates the function that the prototype will
 correspond to.  This indicates the type, linkage and name to use, as well as which
-module to insert into.  "<a href="LangRef.html#linkage">external linkage</a>"
+module to insert into.  "<a href="../LangRef.html#linkage">external linkage</a>"
 means that the function may be defined outside the current module and/or that it
 is callable by functions outside the module.  The Name passed in is the name the
 user specified: since "<tt>TheModule</tt>" is specified, this name is registered
@@ -435,7 +435,7 @@ is an LLVM Function object that is ready to go for us.</p>
 <div class="doc_code">
 <pre>
   // 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-&gt;Codegen()) {
@@ -1079,7 +1079,7 @@ Function *PrototypeAST::Codegen() {
   std::vector&lt;const Type*&gt; 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.
@@ -1122,7 +1122,7 @@ Function *FunctionAST::Codegen() {
     return 0;
   
   // 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-&gt;Codegen()) {