[PATCH] [ms-cxxabi] Mangle nullptr template arguments

David Majnemer david.majnemer at gmail.com
Sun Aug 4 21:58:23 PDT 2013

Comment at: lib/AST/MicrosoftMangle.cpp:889
@@ -888,4 +888,3 @@
   case TemplateArgument::Integral:
-    mangleIntegerLiteral(TA.getAsIntegral(),
-                         TA.getIntegralType()->isBooleanType());
+    mangleIntegerLiteral(TA.getAsIntegral(), /*IsBoolean=*/false);
Richard Smith wrote:
> What's the reason for this change? If it's OK to pass false here, do we need the IsBoolean parameter at all?
An unrelated change slipped in, sorry.

Comment at: lib/AST/MicrosoftMangle.cpp:894
@@ +893,3 @@
+  case TemplateArgument::NullPtr: {
+    mangleIntegerLiteral(llvm::APSInt(/*BitWidth=*/64), /*IsBoolean=*/false);
+    break;
Richard Smith wrote:
> Sending nullptr_t through the integer literal codepath seems unnecessary. All we really know here is that nullptr_t appears to be mangled as A@, so maybe just emit that directly.
While we could do that, I think it makes the mangling scheme a bit more complicated semantically and it decentralizes the mechanism of choosing how to mangle zero-ish things.

As an example: bool template arguments. True and false aren't given special mangling behavior. We "boolify" the integral value, treat the result as an integer and mangle **that** value.


More information about the cfe-commits mailing list