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

David Majnemer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 22 14:04:15 PST 2018


majnemer added a comment.

In https://reviews.llvm.org/D43576#1016418, @zahiraam wrote:

> 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.


We create an AST such that the following:

  struct _GUID;
  
  template <const _GUID *>
  class A {};
  
  struct __declspec(uuid("{DDB47A6A-0F23-11D5-9109-00E0296B75D3}")) S {};
  
  struct __declspec(dllexport) C : public A<&__uuidof(S)> {};

is turned into something like:

  struct _GUID;
  
  __declspec(selectany) __s_GUID const _GUID_ddb47a6a_0f23_11d5_9109_00e0296b75d3 = {...};
  
  template <const _GUID *>
  class A {};
  
  struct __declspec(uuid("{DDB47A6A-0F23-11D5-9109-00E0296B75D3}")) S {};
  
  struct __declspec(dllexport) C : public A<&_GUID_ddb47a6a_0f23_11d5_9109_00e0296b75d3> {};


https://reviews.llvm.org/D43576





More information about the cfe-commits mailing list