r360637 - PR41817: Fix regression in r359260 that caused the MS compatibility

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu May 16 11:51:00 PDT 2019


*From: *Richard Smith <richard at metafoo.co.uk>
*Date: *Wed, May 15, 2019 at 5:43 PM

> On Wed, 15 May 2019 at 15:54, Reid Kleckner via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> 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?
>>
>
> 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?
>

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.

This is what I looked at:
https://searchfox.org/mozilla-central/search?q=symbol:_Z34HandlerData__MIDL_TypeFormatString&redirect=false

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?

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.

Given that this will require mutating IR that we've already created, I'd be
willing to look into it further.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190516/a0a993c0/attachment.html>


More information about the cfe-commits mailing list