[PATCH] Fully handle globals and functions in CGDebugInfo::getDeclarationOrDefinition()

David Blaikie dblaikie at gmail.com
Mon Nov 17 12:48:24 PST 2014


>>! In D6173#8, @friss wrote:
>>>! In D6173#5, @dblaikie wrote:
>> Looks pretty reasonable. Some optional and/or follow-up patch comments.
> 
> I'll commit that with your feedback addressed.
> 
>> Have you considered if/how some of this could be unified with the type decl-or-def handling?
> 
> I kinda did, but there were some unclear points that made me chose the separate handling approach. Maybe you can shed some light on those:
>  - The TypeCache is keyed on the TagType itself. Unifying the map would mean keying on the canonical decl. I /think/ this should be fine, but I couldn't convince myself that I'm not missing something.

I think that should be fine - I forget how it all works, but I believe it's possible to go back & forth between the type and its canonical declaration... (ASTContext probably provides the help there)

>  - In the finalize phase, the type replacement logic asserts that there always is a replacement type registered in the TypeCache, while for decls there might not be one. I'm not actually sure where the guarantee comes from on the type side.

Yeah, we'd have to understand where that guarantee comes from. I think it might be because we (might) be creating stub metadata nodes before we even create the declaration (because we might end up with a definition and circular references, etc) - so the thing we're replacing is actually a stub, not even a declaration. That's only my wildest stab in the dark.

http://reviews.llvm.org/D6173






More information about the llvm-commits mailing list