[PATCH] D110485: Support [[no_unique_address]] for all targets.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 30 09:44:51 PDT 2021


erichkeane added a comment.

In D110485#3033889 <https://reviews.llvm.org/D110485#3033889>, @expnkx wrote:

> In D110485#3030874 <https://reviews.llvm.org/D110485#3030874>, @erichkeane wrote:
>
>> In D110485#3030853 <https://reviews.llvm.org/D110485#3030853>, @expnkx wrote:
>>
>>> clang simply just does not truly support everything msvc supports. There are no things that deals [[msvc::]] attributes at all in the clang. In fact the point of using clang on windows is that we do not want to do the same as Microsoft does.
>>>
>>> Support [[no_unique_address]] is nothing wrong tbh and that is what ISO C++ standard requires.
>>>
>>> If we do not change, the Microsoft team won't wanna change either because they are afraid of breaking clang too.
>>>
>>> I never understand why [[no_unique_address]] is a problem.
>>
>> A requirement of Clang on Windows is that we are ABI compatible (so that we can link between them!), the same way that Linux must match the Itanium ABI.  Allowing no_unique_address on Windows is an ABI compatibility issue.  In this case, we have to pay attention to what the platform's ABI OWNERS define as the ABI, which in this case is Microsoft.
>>
>> THAT is why this is a problem, and THAT is what is wrong with this change.
>>
>> If Microsoft defines an ABI for what this does, we can follow them and just do that.
>
> https://github.com/microsoft/STL/issues/1364
>
> As Microsoft said, the reason why things like msvc::no_unique_address exist are because clang does not support it. In fact, it has become a vicious cycle. msvc waits clang, clang waits msvc.
>
> It is a vicious cycle. I would argue it is LLVM's fault, not Microsoft's fault.
>
> Sure you can add another attribute, i tried that, but adding another attribute for doing exactly the same thing through entire code base is just annoying and headache.
>
> If clang does not support [[no_unique_address]], Microsoft is not going to support it either. Microsoft's own words.
>
> [[no_unique_address]] is ISO C++ standard. Why not support it? I am sorry the entire LLVM did a crappy job on support C++20 standard in general.

My understanding is Microsoft DOES have [[no_unique_address]], it just doesn't do anything, right?  So it seems they have decided the ABI is 'pretend this attribute doesn't exist'.  Implementing this as anything else is an ABI break, which we don't do.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110485/new/

https://reviews.llvm.org/D110485



More information about the cfe-commits mailing list