[PATCH] D19654: PR27132: Proper mangling for __unaligned qualifier (now with PR27367 fixed)

andreybokhanko via cfe-commits cfe-commits at lists.llvm.org
Wed May 4 15:57:11 PDT 2016


What Reid said...

Yours,
Andrey

> 5 мая 2016 г., в 1:48, Reid Kleckner <rnk at google.com> написал(а):
> 
> rnk added inline comments.
> 
> ================
> Comment at: lib/AST/MicrosoftMangle.cpp:1583-1584
> @@ -1579,2 +1582,4 @@
>   case QMM_Result:
> +    // Presence of __unaligned qualifier shouldn't affect mangling here.
> +    Quals.removeUnaligned();
>     if ((!IsPointer && Quals) || isa<TagType>(T)) {
> ----------------
> majnemer wrote:
>> andreybokhanko wrote:
>>> majnemer wrote:
>>>> andreybokhanko wrote:
>>>>> Done. Test added.
>>>> Hmm, can you give a concrete example why we need this line?
>>> Sure. An example is:
>>> 
>>> __unaligned int unaligned_foo3() { return 0; }
>>> 
>>> MS mangles it as
>>> 
>>> ?unaligned_foo3@@YAHXZ
>>> 
>>> However, if __unaligned is taken into account, "if ((!IsPointer && Quals) || isa<TagType>(T))" computes to true and clang adds "?A", resulting to
>>> 
>>> ?unaligned_foo3@@YA?AHXZ
>>> 
>>> Yours,
>>> Andrey
>> Wait, I thought __unaligned can only apply to pointer types.  Is this not so?!
>> Does `__unaligned int x;` really keep it's `__unaligned` qualifier?
> Yeah it does:
>  $ cat t.cpp
>  __unaligned int x;
>  $ cl -nologo -c t.cpp && dumpbin /symbols t.obj  | grep ?x
>  t.cpp
>  008 00000000 SECT3  notype       External     | ?x@@3HFA (int __unaligned x)
> 
> 
> http://reviews.llvm.org/D19654
> 
> 
> 


More information about the cfe-commits mailing list