[PATCH] [ms-cxxabi] Mangle function pointer template arguments correctly
Reid Kleckner
rnk at google.com
Tue Mar 19 18:51:41 PDT 2013
Hi rjmccall,
http://llvm-reviews.chandlerc.com/D554
Files:
lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms-templates.cpp
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -827,6 +827,9 @@
case TemplateArgument::Type:
mangleType(TA.getAsType(), SourceRange());
break;
+ case TemplateArgument::Declaration:
+ mangle(cast<NamedDecl>(TA.getAsDecl()), "$1?");
+ break;
case TemplateArgument::Integral:
mangleIntegerLiteral(TA.getAsIntegral(),
TA.getIntegralType()->isBooleanType());
@@ -836,7 +839,6 @@
break;
case TemplateArgument::Template:
case TemplateArgument::TemplateExpansion:
- case TemplateArgument::Declaration:
case TemplateArgument::NullPtr:
case TemplateArgument::Pack: {
// Issue a diagnostic.
Index: test/CodeGenCXX/mangle-ms-templates.cpp
===================================================================
--- test/CodeGenCXX/mangle-ms-templates.cpp
+++ test/CodeGenCXX/mangle-ms-templates.cpp
@@ -78,3 +78,16 @@
void use() {
space::foo(42);
}
+
+// PR13455
+typedef void (*FunctionPointer)(void);
+
+template <FunctionPointer function>
+void FunctionPointerTemplate() {
+ function();
+}
+
+void spam() {
+ FunctionPointerTemplate<spam>();
+// CHECK: "\01??$FunctionPointerTemplate@$1?spam@@YAXXZ@@YAXXZ"
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D554.1.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130319/703641fd/attachment.bin>
More information about the llvm-commits
mailing list