<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 14, 2015, at 1:37 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Jul 14, 2015 at 12:13 PM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Eric & David,<br class="">
<br class="">
this patch implements bare-bones LVM support for external type references as previously discussed in <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9612&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=lkc4MLRBHs6vekbY_vOxyTZexF4LFIaH-2QO1-XRmA0&s=lt90nqTEZhtfQelUMh6dNeIjlGniYAh-UkKd2Kf1Xw0&e=" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D9612</a>.<br class="">
This is a necessary prerequisite for bootstrapping the emission of debug info inside modules.<br class="">
<br class="">
- Add a FlagExternalTypeRef to DICompositeType. External types must have a unique identifier.<br class="">
- External type references are emitted in the short form DW_AT_type([DW_FORM_ref_sig8]) but the long form with an indirect reference is also supported (see test case for examples).<br class=""></blockquote><div class=""><br class="">Knee-jerk reaction (haven't looked at the patch yet): Long form will be necessary for all the implicit things (you won't know which implicit things go in the module debug info, because you can't instantiate them ahead of time - well, maybe you can in a SFINAE trap... - but then there's still member function template implicit specializations and nested classes).</div></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">It might be best to implement the general form first, then look at an optimization for the "has no children" case separately (& in a way that applies to normal type unit references too)<br class=""></div></div></div></div></div></blockquote><div>That would be easy, we just cut the 4 lines that emit the short form from the patch :-)</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">What happens for that today? (I see you have a nested imported declaration that's forcing the emission of the type declaration, I take it? What happens if the type is also referenced separately - does it get a sig8 there too, or does it use the 4 byte section offset to refer to the type declaration which has the sole sig8?)<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>With this patch we would end up with a sig8 in the AT_type and an AT_signature in the forward declaration. Emitting a ref4 to the declaration is actually tricky because the entity that triggers the creation of the forward declaration may not have been visited yet.</div></div><br class=""><div class="">I think you’re right that it would be safer to just always emit the long form and treat the short form as an optimization left for later.</div><div class=""><br class=""></div><div class="">-- adrian</div></body></html>