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

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 28 10:00:24 PDT 2016


majnemer added inline comments.

================
Comment at: lib/AST/MicrosoftMangle.cpp:1446-1451
@@ -1445,5 +1445,8 @@
     Out << 'E';
 
+  if (!PointeeType.isNull() && PointeeType.getLocalQualifiers().hasUnaligned())
+    Out << 'F';
+
   if (HasRestrict)
     Out << 'I';
 }
----------------
Have you tested `__restrict` with `__unaligned` on MSVC?  I don't see a test for it here.

================
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 << '?';
----------------
It would be good to see what MSVC does with:

```
template <typename T>
T f(T t) { return t; }
```

Where `T` is instantiated with `int *` and `int __unaligned *`.

================
Comment at: lib/Sema/SemaType.cpp:1787
@@ -1787,1 +1786,3 @@
+  // TQ_unaligned;
+  unsigned CVR = CVRAU & ~DeclSpec::TQ_atomic & ~DeclSpec::TQ_unaligned;
 
----------------
This would probably be easier to read if written as:
  unsigned CVR = CVRAU & ~(DeclSpec::TQ_atomic | DeclSpec::TQ_unaligned);


http://reviews.llvm.org/D19654





More information about the cfe-commits mailing list