Attributes and redeclarations

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Attributes and redeclarations

Sumner, Brian via cfe-dev
Hi, all. Michael Ilseman and I were working with the Clang AST (for Swift purposes) and wanted to check something about the behavior of attributes and redeclarations: are they supposed to be propagated forward, so that the most recent declaration has all of the attributes? Or copied back onto the canonical declaration? I have a vague memory that this is the case for function declarations, but the case we care about (today) is redeclarations of typedefs, and it doesn't seem to be occurring there.

typedef int WrappedInt;
typedef int WrappedInt __attribute__((swift_wrapper(struct)));
typedef int WrappedInt;

Thanks,
Jordan
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Attributes and redeclarations

Sumner, Brian via cfe-dev
[re-adding cfe-dev] Ah, maybe we should have been using InheritableAttr all along. Thanks, Erich!

Jordan

> On Jul 20, 2017, at 15:23, Keane, Erich <[hidden email]> wrote:
>
> I couldn’t find 'swift_wrapper' as an attribute, however you can check out the AST here:
> https://godbolt.org/g/vDnEJm
>
> I did it with 'aligned'.  It attaches to the 2nd decl, and gets inherited by the 3rd.
>
> -----Original Message-----
> From: cfe-dev [mailto:[hidden email]] On Behalf Of Jordan Rose via cfe-dev
> Sent: Thursday, July 20, 2017 3:01 PM
> To: [hidden email]
> Subject: [cfe-dev] Attributes and redeclarations
>
> Hi, all. Michael Ilseman and I were working with the Clang AST (for Swift purposes) and wanted to check something about the behavior of attributes and redeclarations: are they supposed to be propagated forward, so that the most recent declaration has all of the attributes? Or copied back onto the canonical declaration? I have a vague memory that this is the case for function declarations, but the case we care about (today) is redeclarations of typedefs, and it doesn't seem to be occurring there.
>
> typedef int WrappedInt;
> typedef int WrappedInt __attribute__((swift_wrapper(struct)));
> typedef int WrappedInt;
>
> Thanks,
> Jordan
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...