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

Andrey Bokhanko via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 29 05:40:15 PDT 2016


andreybokhanko marked 3 inline comments as done.
andreybokhanko added a comment.

David, thank you for the review!

In http://reviews.llvm.org/D19654#416408, @majnemer wrote:

> It would be good to have a test for the variable template case:
>
>   template <typename T>
>   T x;
>  
>   auto g() { return x<int __unaligned *>; }
>
>
> should mangle to `??$x at PEFAH@@3PEFAHEFA`


It mangles exaclty to `??$x at PEFAH@@3PEFAHEFA` (in 64 bit mode). Test added.


================
Comment at: lib/AST/MicrosoftMangle.cpp:1446-1451
@@ -1445,5 +1445,8 @@
     Out << 'E';
 
   if (HasRestrict)
     Out << 'I';
+
+  if (!PointeeType.isNull() && PointeeType.getLocalQualifiers().hasUnaligned())
+    Out << 'F';
 }
----------------
Good catch!

Indeed, __restrict and __unaligned are mangled in a different order. Fixed; test added.

================
Comment at: lib/AST/MicrosoftMangle.cpp:1583-1585
@@ -1579,3 +1582,5 @@
   case QMM_Result:
+    // Presence of __unaligned qualifier shouldn't affect mangling here.
+    Quals.removeUnaligned();
     if ((!IsPointer && Quals) || isa<TagType>(T)) {
       Out << '?';
----------------
Done. Test added.


http://reviews.llvm.org/D19654





More information about the cfe-commits mailing list