More mangling work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82265 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 5df2a34..057d57e 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -511,8 +511,15 @@
if (mangleSubstitution(cast<NamedDecl>(DC)))
return;
- manglePrefix(DC->getParent());
- mangleUnqualifiedName(cast<NamedDecl>(DC));
+ // Check if we have a template.
+ const TemplateArgumentList *TemplateArgs = 0;
+ if (const NamedDecl *TD = isTemplate(cast<NamedDecl>(DC), TemplateArgs)) {
+ mangleTemplatePrefix(TD);
+ mangleTemplateArgumentList(*TemplateArgs);
+ } else {
+ manglePrefix(DC->getParent());
+ mangleUnqualifiedName(cast<NamedDecl>(DC));
+ }
addSubstitution(cast<NamedDecl>(DC));
}
@@ -790,11 +797,6 @@
mangleName(T->getDecl()->getTypedefForAnonDecl());
else
mangleName(T->getDecl());
-
- // If this is a class template specialization, mangle the template arguments.
- if (ClassTemplateSpecializationDecl *Spec
- = dyn_cast<ClassTemplateSpecializationDecl>(T->getDecl()))
- mangleTemplateArgumentList(Spec->getTemplateArgs());
}
// <type> ::= <array-type>