[PATCH] D116203: [clang] adds unary type transformations as compiler built-ins

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 6 17:42:06 PDT 2022

rsmith added inline comments.

Comment at: clang/lib/AST/ItaniumMangle.cpp:3928
+      case UnaryTransformType::AddConst:
+        Out << "2ac";
cjdb wrote:
> aaron.ballman wrote:
> > Are these the suggested manglings from the Itanium mangling document, or something you invented yourself?
> > 
> > Should there be corresponding Microsoft manglings or are those already handled magically?
> > 
> > Also, test coverage for the manglings?
> I copied the mangling from D67052 and then inferred for what's missing over there. I'll consult the Itanium mangling doc to ensure that they're correct. How can I check the corresponding Microsoft manglings are handled?
This is mangling the trait as a vendor-specific type *qualifier*, so `__add_lvalue_reference(T)` will demangle as `alref T` instead. The underlying_type trait probably does this because it predates the Itanium ABI having a mangling form for a vendor-specific type *specifier* with arguments. Also, if we want this to demangle properly, we should follow the ABI specification's recommendations and use the actual source name of the builtin. So I think the ideal manglings (other than being kinda long, which probably doesn't matter given that these are unlikely to show up in actual mangled names) would be things like:

`u13__add_pointerI` ... inner type mangling ... `E`

It would probably be OK to change the mangling for `__enum_underlying_type` to this form too. I doubt that's made it into real mangled names in the wild, but if you want to add `-fclang-abi-compat` support for that, it wouldn't hurt.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list