[PATCH] Output debug information for structure members only referenced by a pointer or typedef

David Blaikie dblaikie at gmail.com
Thu Jun 20 15:04:35 PDT 2013


On Thu, Jun 20, 2013 at 2:54 PM, Renato Golin <renato.golin at linaro.org> wrote:
> On 20 June 2013 22:17, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> I've talked to Richard Smith about a more
>> principled approach where we could add a new ASTConsumer callback that
>> fires whenever Sema discovers that a complete type is required
>> (Sema::RequireCompleteType is called for the first time on a type).
>
>
> I know it sounds wrong, but couldn't you add the info on all declaration and
> let DCE remove it if not needed?

I can't say I really understand the question. You mean emit
definitions in the debug info LLVM IR metadata always (when the type
is defined in the TU, at least) & then have LLVM decide whether to
emit the definition or just a declaration?

Not really - the backend doesn't really know when/how to make that
choice & just because we've optimized away all the code is no reason
not to emit it. (& types especially don't necessarily connect to any
code - or at least not in any way that is easily distinguishable
between declaration and definition type uses).

>
> Ie. I'm actually surprised that it doesn't... Does it?
>
>
>> So next time we go
>> to retrieve it, even if this time we say we need a definition, we
>> retrieve the cached typedef type and use that - never pushing further
>> into it to emit the definition of the nested type.
>
>
> Oh, I remember vaguely having a similar bug on our front end, because you
> don't want to create a declaration for both types if they're related and end
> up with different metadata for each path. I don't remember how I solved it,
> but it was definitely the wrong way, because Dwarf was, by far, the worst
> part of our bridge. ;)
>
> cheers,
> --renato



More information about the cfe-commits mailing list