[LLVMdev] DIFactory

Renato Golin renato.golin at arm.com
Mon Feb 21 07:00:14 PST 2011


On 19 February 2011 04:31, Talin <viridia at gmail.com> wrote:
> A couple of other questions about DIBuilder:
> 1) I notice that there's no 'isMain' parameter to CreateCompileUnit. How do
> you specify the main module?
> 2) There's no means to set TheCU other than creating a new compile unit.
> This means that you have to generate all of the debug info for your module
> with a single DIBuilder instance, since there's no way to use a pre-existing
> compile unit.

A few more concerns:

By putting the copy ctor in private, I can't define a DIBuilder in a
context and assign it later with a respective module (or re-assign it
for that matter).

To overcome this, I've created a pointer to a DIBuilder and only
create it when I have the module information. I have to do this
because the front-end is not in C++, so I can't use the ctor init
trick on DIBuilder like clang does.

But that seems to be getting in the way of the DIDescriptor "operator
MDNode *" or whatever is converting a DIDescriptor into a Value* in
the code below (CGDebugInfo.cpp):

  llvm::Value *Subscript = DBuilder.GetOrCreateSubrange(0, NumElems);

since GetOrCreateSubrange() returns a DISubrange (not a pointer) both
in DIFactory and DIBuilder.

Any pointers? (pardon the pun)

-- 
cheers,
--renato



More information about the llvm-dev mailing list