r210198 - MS-ABI: Mangle empty template parameter packs correctly
David Majnemer
david.majnemer at gmail.com
Wed Jun 4 09:46:32 PDT 2014
Author: majnemer
Date: Wed Jun 4 11:46:32 2014
New Revision: 210198
URL: http://llvm.org/viewvc/llvm-project?rev=210198&view=rev
Log:
MS-ABI: Mangle empty template parameter packs correctly
Tested for compatibility with VS2013.
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=210198&r1=210197&r2=210198&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Jun 4 11:46:32 2014
@@ -1174,11 +1174,16 @@ void MicrosoftCXXNameMangler::mangleTemp
case TemplateArgument::Expression:
mangleExpression(TA.getAsExpr());
break;
- case TemplateArgument::Pack:
- // Unlike Itanium, there is no character code to indicate an argument pack.
- for (const TemplateArgument &PA : TA.getPackAsArray())
- mangleTemplateArg(TD, PA);
+ case TemplateArgument::Pack: {
+ llvm::ArrayRef<TemplateArgument> TemplateArgs = TA.getPackAsArray();
+ if (TemplateArgs.empty()) {
+ Out << "$S";
+ } else {
+ for (const TemplateArgument &PA : TemplateArgs)
+ mangleTemplateArg(TD, PA);
+ }
break;
+ }
case TemplateArgument::Template:
mangleType(cast<TagDecl>(
TA.getAsTemplate().getAsTemplateDecl()->getTemplatedDecl()));
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp?rev=210198&r1=210197&r2=210198&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp Wed Jun 4 11:46:32 2014
@@ -133,3 +133,9 @@ void A::foo() __restrict && {}
int operator"" _deg(long double) { return 0; }
// CHECK-DAG: @"\01??__K_deg@@YAHO at Z"
+
+template <char...>
+void templ_fun_with_pack() {}
+
+template void templ_fun_with_pack<>();
+// CHECK-DAG: @"\01??$templ_fun_with_pack@$S@@YAXXZ"
More information about the cfe-commits
mailing list