[cfe-commits] r92030 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle.cpp
Anders Carlsson
andersca at mac.com
Wed Dec 23 11:30:55 PST 2009
Author: andersca
Date: Wed Dec 23 13:30:55 2009
New Revision: 92030
URL: http://llvm.org/viewvc/llvm-project?rev=92030&view=rev
Log:
Mangle template template parameters. Fixes PR5861.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=92030&r1=92029&r2=92030&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Dec 23 13:30:55 2009
@@ -125,8 +125,8 @@
void mangleTemplateArgs(const TemplateArgument *TemplateArgs,
unsigned NumTemplateArgs);
- void mangleTemplateArgumentList(const TemplateArgumentList &L);
- void mangleTemplateArgument(const TemplateArgument &A);
+ void mangleTemplateArgs(const TemplateArgumentList &L);
+ void mangleTemplateArg(const TemplateArgument &A);
void mangleTemplateParameter(unsigned Index);
};
@@ -321,7 +321,7 @@
const TemplateArgumentList *TemplateArgs = 0;
if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
mangleUnscopedTemplateName(TD);
- mangleTemplateArgumentList(*TemplateArgs);
+ mangleTemplateArgs(*TemplateArgs);
return;
}
@@ -524,7 +524,7 @@
const TemplateArgumentList *TemplateArgs = 0;
if (const TemplateDecl *TD = isTemplate(ND, TemplateArgs)) {
mangleTemplatePrefix(TD);
- mangleTemplateArgumentList(*TemplateArgs);
+ mangleTemplateArgs(*TemplateArgs);
} else {
manglePrefix(DC);
mangleUnqualifiedName(ND);
@@ -580,7 +580,7 @@
const TemplateArgumentList *TemplateArgs = 0;
if (const TemplateDecl *TD = isTemplate(cast<NamedDecl>(DC), TemplateArgs)) {
mangleTemplatePrefix(TD);
- mangleTemplateArgumentList(*TemplateArgs);
+ mangleTemplateArgs(*TemplateArgs);
} else {
manglePrefix(DC->getParent());
mangleUnqualifiedName(cast<NamedDecl>(DC));
@@ -1186,11 +1186,11 @@
}
}
-void CXXNameMangler::mangleTemplateArgumentList(const TemplateArgumentList &L) {
+void CXXNameMangler::mangleTemplateArgs(const TemplateArgumentList &L) {
// <template-args> ::= I <template-arg>+ E
Out << "I";
for (unsigned i = 0, e = L.size(); i != e; ++i)
- mangleTemplateArgument(L[i]);
+ mangleTemplateArg(L[i]);
Out << "E";
}
@@ -1199,11 +1199,11 @@
// <template-args> ::= I <template-arg>+ E
Out << "I";
for (unsigned i = 0; i != NumTemplateArgs; ++i)
- mangleTemplateArgument(TemplateArgs[i]);
+ mangleTemplateArg(TemplateArgs[i]);
Out << "E";
}
-void CXXNameMangler::mangleTemplateArgument(const TemplateArgument &A) {
+void CXXNameMangler::mangleTemplateArg(const TemplateArgument &A) {
// <template-arg> ::= <type> # type or template
// ::= X <expression> E # expression
// ::= <expr-primary> # simple expressions
@@ -1215,6 +1215,9 @@
case TemplateArgument::Type:
mangleType(A.getAsType());
break;
+ case TemplateArgument::Template:
+ mangleName(A.getAsTemplate().getAsTemplateDecl());
+ break;
case TemplateArgument::Expression:
Out << 'X';
mangleExpression(A.getAsExpr());
Modified: cfe/trunk/test/CodeGenCXX/mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle.cpp?rev=92030&r1=92029&r2=92030&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle.cpp Wed Dec 23 13:30:55 2009
@@ -290,3 +290,19 @@
// CHECK: define %struct.Ops* @_ZN3OpsmlERKS_
Ops& Ops::operator*(const Ops&) { return *this; }
+// PR5861
+namespace PR5861 {
+template<bool> class P;
+template<> class P<true> {};
+
+template<template <bool> class, bool>
+struct Policy { };
+
+template<typename T, typename = Policy<P, true> > class Alloc
+{
+ T *allocate(int, const void*) { return 0; }
+};
+
+// CHECK: define i8* @_ZN6PR58615AllocIcNS_6PolicyINS_1PELb1EEEE8allocateEiPKv
+template class Alloc<char>;
+}
More information about the cfe-commits
mailing list