[LLVMdev] DIFactory

Devang Patel devang.patel at gmail.com
Wed Jul 14 10:21:07 PDT 2010

On Wed, Jul 14, 2010 at 8:34 AM, Renato Golin <rengolin at systemcall.org> wrote:
> Hi All,
> Is there any documentation on how to use DIFactory to generate basic debug info?

Use Create* methods to create basic debug info. There is not any
tutorial document explaining how to generated basic debug info.

> It seems similar enough to IRBuilder but working with objects (rather
> than pointers) and that's raising some issues.

It is encapsulating how debug info is encoded. Earlier it was using
GlobalVariable, now it uses MDNode. The idea is that debug info user
will only rely on DIDescriptor class hierarchy to manipulate debug
info. The classes in this hierarchy are light weight enough to pass
around as objects.

It is on my wish list to enhance IRBuilder to cover functionality
supported by DIFactory. If you're interested then patches are welcome
in that direction!

> Also, am I supposed to run the ModuleDebugInfoPrinterPass manually, or
> it gets printed automatically when I WriteBitcodeToFile?

Debug info is encoded in llvm IR as MDNodes. And all MDNodes from a
Module, just like any other llvm values, are automatically emitted
when the Module is written to a bitcode file.


More information about the llvm-dev mailing list