[PATCH] D13263: Addition of __attribute__((pass_object_size)) to Clang

David Majnemer via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 1 13:38:21 PST 2015


majnemer added inline comments.

================
Comment at: lib/AST/MicrosoftMangle.cpp:1844-1857
@@ -1843,4 +1843,16 @@
     // Happens for function pointer type arguments for example.
-    for (const QualType &Arg : Proto->param_types())
-      mangleArgumentType(Arg, Range);
+    for (unsigned I = 0, E = Proto->getNumParams(); I != E; ++I) {
+      mangleArgumentType(Proto->getParamType(I), Range);
+      // Mangle each pass_object_size parameter as if it's a paramater of enum
+      // type passed directly after the parameter with the pass_object_size
+      // attribute. The aforementioned enum's name is __pass_object_size, and we
+      // pretend it resides in a top-level namespace called __ext.
+      //
+      // FIXME: Is there a defined extension notation for the MS ABI, or is it
+      // necessary to just cross our fingers and hope this type+namespace
+      // combination doesn't conflict with anything?
+      if (D)
+        if (auto *P = D->getParamDecl(I)->getAttr<PassObjectSizeAttr>())
+          Out << "W4__pass_object_size" << P->getType() << "@__ext@@";
+    }
     // <builtin-type>      ::= Z  # ellipsis
----------------
This seems fine to me, I'd change the namespace to something like `__clang` though.


http://reviews.llvm.org/D13263





More information about the cfe-commits mailing list