<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear all,<div><br></div><div>I'm trying to run the example of recursive type construction examples in LLVM Programmer's Manual, here is the code:</div><div><br></div><div><span class="Apple-style-span" style="font-family: Times; font-size: 16px; "><div class="doc_code" style="border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: gray; border-right-color: gray; border-bottom-color: gray; border-left-color: gray; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(238, 238, 238); margin-top: 0px; margin-right: 1em; margin-bottom: 0px; margin-left: 1em; padding-top: 0px; padding-right: 1em; padding-bottom: 0px; padding-left: 1em; display: table; position: static; z-index: auto; "><pre>// <i>Create the initial outer struct</i>
<a href="http://llvm.org/docs/ProgrammersManual.html#PATypeHolder">PATypeHolder</a> StructTy = OpaqueType::get();
std::vector<const Type*> Elts;
Elts.push_back(PointerType::get(StructTy));
Elts.push_back(Type::Int32Ty);
StructType *NewSTy = StructType::get(Elts);
// <i>At this point, NewSTy = "{ opaque*, i32 }". Tell VMCore that</i>
// <i>the struct and the opaque type are actually the same.</i>
cast<OpaqueType>(StructTy.get())-><a href="http://llvm.org/docs/ProgrammersManual.html#refineAbstractTypeTo">refineAbstractTypeTo</a>(NewSTy);
// <i>NewSTy is potentially invalidated, but StructTy (a <a href="http://llvm.org/docs/ProgrammersManual.html#PATypeHolder">PATypeHolder</a>) is</i>
// <i>kept up-to-date</i>
NewSTy = cast<StructType>(StructTy.get());
// <i>Add a name for the type to the module symbol table (optional)</i>
MyModule->addTypeName("mylist", NewSTy);</pre></div></span></div><div><br></div><div><br></div><div>However, it does not work. The compiler says that the API of PointerType::get(PATypeHolder &) does not exist. </div><div><br></div><div>It seems that the API has been removed from LLVM trunk.</div><div><br></div><div>I'd be very appreciated if you could tell me how to construct Recursive Type using the LLVM trunk API.</div><div><br></div><div>Thank you very much.</div><div><br></div><div>Best,</div><div><br></div><div>Haohui</div></body></html>