r187741 - [ms-cxxabi] Mangle nullptr template arguments
David Majnemer
david.majnemer at gmail.com
Mon Aug 5 14:34:00 PDT 2013
Author: majnemer
Date: Mon Aug 5 16:33:59 2013
New Revision: 187741
URL: http://llvm.org/viewvc/llvm-project?rev=187741&view=rev
Log:
[ms-cxxabi] Mangle nullptr template arguments
MSVC mangles nullptr template arguments identically to zero literals.
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=187741&r1=187740&r2=187741&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Mon Aug 5 16:33:59 2013
@@ -889,6 +889,9 @@ void MicrosoftCXXNameMangler::mangleTemp
mangleIntegerLiteral(TA.getAsIntegral(),
TA.getIntegralType()->isBooleanType());
break;
+ case TemplateArgument::NullPtr:
+ Out << "$0A@";
+ break;
case TemplateArgument::Expression:
mangleExpression(TA.getAsExpr());
break;
@@ -901,8 +904,7 @@ void MicrosoftCXXNameMangler::mangleTemp
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,
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp?rev=187741&r1=187740&r2=187741&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Mon Aug 5 16:33:59 2013
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
-// RUN: %clang_cc1 -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s
template<typename T>
class Class {
@@ -156,3 +156,8 @@ void variadic_class_instantiate() {
}
// 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: "\01?f@@YAXU?$S1@$0A@@@@Z"
More information about the cfe-commits
mailing list