[PATCH] D43576: Solution to fix PR27066 - Redefinition with same mangled name as another definition (dllexport and uuid)

Zahira Ammarguellat via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 14 08:20:45 PDT 2018


zahiraam added a comment.

In https://reviews.llvm.org/D43576#1016295, @majnemer wrote:

> We should really, really avoid making this sort of change without first trying to desugar uuidof into a reference to a variable. That would solve a ton of problems, problems like this one.


Not sure I fully understand what you are proposing?

Are you proposing that generated symbols like this:
??4?$A@$E?_GUID_ddb47a6a_0f23_11d5_9109_00e0296b75d3@@3U__s_GUID@@B@@QEAAAEAV0 at AEBV0@@Z 
Be de-sugared? Wouldn't that be different that what MS is doing? 
Can you please give me more details about what you are thinking of?
Thanks.

In https://reviews.llvm.org/D43576#1019943, @rsmith wrote:

> In https://reviews.llvm.org/D43576#1019703, @zahiraam wrote:
>
> > Currently this declaration:
> > struct
> >  __declspec(uuid("{DDB47A6A-0F23-11D5-9109-00E0296B75D3}"))
> >  S1;
> >
> > a CXXRecordDecl type is generated with attributes (the uuid being an attribute). Are you proposing that instead a new type is generated for S1 say something like CXXUuidRecord? And create also a new TagType that corresponds to this new Decl?
>
>
> No. Concretely, I'd suggest we create a new `UuidDecl` object representing the `_GUID` object. An instance of `UuidDecl` would be created and owned by the `uuid` attribute, and `__uuidof(X)` would denote the `UuidDecl` owned by the `uuid` attribute on the `CXXRecordDecl`. We'd also need some way to form redeclaration chains for `UuidDecl`s (which means we'll need a map from UUID to `UuidDecl` somewhere, perhaps on the `ASTContext`).




In https://reviews.llvm.org/D43576#1019943, @rsmith wrote:

> In https://reviews.llvm.org/D43576#1019703, @zahiraam wrote:
>
> > Currently this declaration:
> > struct
> >  __declspec(uuid("{DDB47A6A-0F23-11D5-9109-00E0296B75D3}"))
> >  S1;
> >
> > a CXXRecordDecl type is generated with attributes (the uuid being an attribute). Are you proposing that instead a new type is generated for S1 say something like CXXUuidRecord? And create also a new TagType that corresponds to this new Decl?
>
>
> No. Concretely, I'd suggest we create a new `UuidDecl` object representing the `_GUID` object. An instance of `UuidDecl` would be created and owned by the `uuid` attribute, and `__uuidof(X)` would denote the `UuidDecl` owned by the `uuid` attribute on the `CXXRecordDecl`. We'd also need some way to form redeclaration chains for `UuidDecl`s (which means we'll need a map from UUID to `UuidDecl` somewhere, perhaps on the `ASTContext`).


As per Richard comment. I have added a UuidDecl owned by the uuid attribute. This patch concerns only this change. It is not a patch to fix the bug yet. I want to make sure that we are in agreement with my changes first. Then I will change the code that deal with ParseCXUuid. 
Comments are welcome. 
Thanks.


https://reviews.llvm.org/D43576





More information about the cfe-commits mailing list