aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r--lib/CodeGen/Mangle.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 5df2a34def..057d57e951 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -511,8 +511,15 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC) {
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 @@ void CXXNameMangler::mangleType(const TagType *T) {
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>