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

David Majnemer david.majnemer at gmail.com
Sun Aug 4 13:50:53 PDT 2013


    - Remove an unrelated change that slipped in

Hi rnk, timurrrr,

http://llvm-reviews.chandlerc.com/D1284

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1284?vs=3185&id=3187#toc

Files:
  lib/AST/MicrosoftMangle.cpp
  test/CodeGenCXX/mangle-ms-templates.cpp

Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -889,6 +889,12 @@
     mangleIntegerLiteral(TA.getAsIntegral(),
                          TA.getIntegralType()->isBooleanType());
     break;
+  // NullPtr is just a special case of an Integral argument with value 0 as of
+  // MSVC 2013
+  case TemplateArgument::NullPtr: {
+    mangleIntegerLiteral(llvm::APSInt(/*BitWidth=*/64), /*IsBoolean=*/false);
+    break;
+  }
   case TemplateArgument::Expression:
     mangleExpression(TA.getAsExpr());
     break;
@@ -901,8 +907,7 @@
       mangleTemplateArg(TD, *I, ArgIndex);
     break;
   case TemplateArgument::Template:
-  case TemplateArgument::TemplateExpansion:
-  case TemplateArgument::NullPtr: {
+  case TemplateArgument::TemplateExpansion: {
     // Issue a diagnostic.
     DiagnosticsEngine &Diags = Context.getDiags();
     unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
Index: test/CodeGenCXX/mangle-ms-templates.cpp
===================================================================
--- test/CodeGenCXX/mangle-ms-templates.cpp
+++ test/CodeGenCXX/mangle-ms-templates.cpp
@@ -156,3 +156,8 @@
 }
 // CHECK: call {{.*}} @"\01??0?$VariadicClass at HD_N@@QAE at XZ"
 // CHECK: call {{.*}} @"\01??0?$VariadicClass at _NDH@@QAE at XZ"
+
+// PR16788
+template <decltype(__nullptr)> struct S1 {};
+void f(S1<__nullptr>) {}
+// CHECK: "\01f@@YAXU?$S1@$0A@@@@Z"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1284.2.patch
Type: text/x-patch
Size: 1493 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130804/4b9d2c33/attachment.bin>


More information about the cfe-commits mailing list