[llvm-commits] [llvm] r97990 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h

Devang Patel dpatel at apple.com
Wed Mar 10 16:47:20 PST 2010

On Mar 10, 2010, at 4:01 PM, Jeffrey Yasskin wrote:

> On Tue, Mar 9, 2010 at 12:22 PM, Devang Patel <dpatel at apple.com> wrote:
>> On Mar 9, 2010, at 10:54 AM, Jeffrey Yasskin wrote:
>>> Now that nothing uses the result of constructCompileUnit() unless it
>>> assigns the ModuleCU, can we just bail early when !DIUnit.isMain() and
>>> avoid new'ing the DIE and CompileUnit?
>> With the introduction of DIFile, we are moving away from "isMain" field.
>>> Then, if we delete ModuleCU in
>>> endModule(), this memory leak would go away.
>> We should delete ModuleCU. That's an oversight. Please fix it or let me know, I'll do it.
> I can take it. I assume it's correct to simply not create the
> CompileUnits and DIEs whose addresses aren't obviously passed
> anywhere? Or do I need to look out for constructors or other functions
> that escape their addresses surreptitiously?

Now there is only one compile unit so it is simpler. Regarding other DIEs, it is expected that DIEs are created only if they will be emitted in the output. In other words, unused DIEs are not created. It would good to find and fix leaks in this area.

More information about the llvm-commits mailing list