Implement name mangling for template template parameters

llvm-svn: 95427
This commit is contained in:
Douglas Gregor 2010-02-05 20:45:00 +00:00
parent 6a93195783
commit a16b0cae9a
2 changed files with 22 additions and 2 deletions

View File

@ -400,6 +400,13 @@ void CXXNameMangler::mangleUnscopedTemplateName(const TemplateDecl *ND) {
if (mangleSubstitution(ND))
return;
// <template-template-param> ::= <template-param>
if (const TemplateTemplateParmDecl *TTP
= dyn_cast<TemplateTemplateParmDecl>(ND)) {
mangleTemplateParameter(TTP->getIndex());
return;
}
mangleUnscopedName(ND->getTemplatedDecl());
addSubstitution(ND);
}
@ -674,15 +681,21 @@ void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND) {
// <template-prefix> ::= <prefix> <template unqualified-name>
// ::= <template-param>
// ::= <substitution>
// <template-template-param> ::= <template-param>
// <substitution>
if (mangleSubstitution(ND))
return;
// FIXME: <template-param>
// <template-template-param> ::= <template-param>
if (const TemplateTemplateParmDecl *TTP
= dyn_cast<TemplateTemplateParmDecl>(ND)) {
mangleTemplateParameter(TTP->getIndex());
return;
}
manglePrefix(ND->getDeclContext());
mangleUnqualifiedName(ND->getTemplatedDecl());
addSubstitution(ND);
}

View File

@ -365,3 +365,10 @@ namespace test0 {
}
// CHECK: define linkonce_odr void @_ZN5test01jINS_1AEEEvRAszmecvT__E6buffer_c(
}
namespace test1 {
template<typename T> struct X { };
template<template<class> class Y, typename T> void f(Y<T>) { }
// CHECK: define void @_ZN5test11fINS_1XEiEEvT_IT0_E
template void f(X<int>);
}