<div dir="ltr">LLVM has some standard ownership conventions:<div>- A LLVMContext owns constants and types, and must outlive all other IR data structures using it</div><div>- A Module owns all functions, globals, aliases, metadata, and other stuff in it</div><div>- A Function owns all basic blocks in it</div><div>- A BasicBlock owns all of its instructions</div><div><br></div><div>Disposing a module should throw away all the other IR it contains, but you also need to throw away the context if you want to really throw away all of LLVM's state.</div><div><br></div><div>LLVM typically copies symbol names into it's own internal data structures, so any strings you allocate for symbol names are owned by the frontend.</div><div><br></div><div>I'm not familiar with DIBuilder, but I'm pretty sure the metadata it creates is owned by the module or context depending on the type.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 2, 2014 at 10:55 AM, Rodney M. Bates <span dir="ltr"><<a href="mailto:rodney_bates@lcwb.coop" target="_blank">rodney_bates@lcwb.coop</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am, from a front end, calling functions like LLVMModuleCreateWithName, found<br>
in Core.h, ultimately calling LLVMWriteBitcodeToFile, found in BitWriter.h.<br>
<br>
Do I correctly presume, from the existence of LLVMDisposeModule, that<br>
I am responsible for calling it when I'm done?  Will I need to do deeper<br>
disposing myself?  I presume at least I will need to free strings I allocated<br>
myself, such as the module name I passed in.<br>
<br>
What about, for example, llvm::DIBuilder::<u></u>DICreateCompileUnit?  I haven't<br>
been able so far to find a companion dispose for this object.<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
-- <br>
Rodney Bates<br>
<a href="mailto:rodney.m.bates@acm.org" target="_blank">rodney.m.bates@acm.org</a><br>
______________________________<u></u>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a><br>
</font></span></blockquote></div><br></div>