<div dir="ltr"><div dir="ltr"><strong>From: </strong>Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>></span><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><strong>Date: </strong>Wed, May 15, 2019 at 5:43 PM<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Wed, 15 May 2019 at 15:54, Reid Kleckner via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div>We could probably re-land Richard's change (although it's quite a lot of code...), but... drop the conflicting `static` on the floor if hasLinkageBeenComputed() returns true. That would work around the assert, right?</div></div></div></div></div></div></blockquote><div><br></div><div>Yes, that seems like it could work, though I really don't like our generated code depending on when we happen to compute linkage. In the MIDL case, are there any uses of the global between the 'extern' declaration and the 'static' declaration? </div></div></div></blockquote><div><br></div><div>Hm, there actually are uses, so I think my suggestion isn't enough. It makes sense, MIDL is creating forward decls so they can be referenced before they are defined.</div><div><br></div><div>This is what I looked at: <a href="https://searchfox.org/mozilla-central/search?q=symbol:_Z34HandlerData__MIDL_TypeFormatString&redirect=false">https://searchfox.org/mozilla-central/search?q=symbol:_Z34HandlerData__MIDL_TypeFormatString&redirect=false</a></div><div><br></div><div>Why were we getting static linkage before anyway? We just happened to look at the last declaration instead of the first or canonical one when doing IRGen?</div><div><br></div><div>In the context of C, downgrading from extern to static isn't such a big deal. We could only implement it for C, since that's what MSVC does.</div><div><br></div><div>Given that this will require mutating IR that we've already created, I'd be willing to look into it further.</div></div></div>