[PATCH] Sema: Treat dllimport globals without explicit storage class as extern

Nico Rieck nico.rieck at gmail.com
Wed Mar 5 07:01:27 PST 2014


On 04.03.2014 03:36, Richard Smith wrote:
> I'm concerned that you may be updating the storage class too late; at the
> point where you update the storage class, it's already been used for
> several things. Can you move this earlier? (I expect this won't be trivial
> since you can't just look for an attribute because you won't have a Decl
> yet...)

Looking at the code, the main issue seems to be that such a variable
would get the wrong DeclContext because
adjustContextForLocalExternDecl() is never called. This seems really ugly.

I could for this special cause check the parsed attributes for dllimport
(the only checking done when creating a DLLImportAttr is for valid
subjects, so this is fulfilled).

Do you have an idea what could go wrong when the DeclContext is not
adjusted? Since the current tests don't expose this. Maybe it's possible
to provoke wrong behavior but I've been unsuccessful so far.

-Nico



More information about the cfe-commits mailing list