Make the mangler conform even better to the grammar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82262 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 61b42b9..5df2a34 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -262,8 +262,13 @@
}
}
- // FIXME: Check if we have a class template.
-
+ // Check if we have a class template.
+ if (const ClassTemplateSpecializationDecl *Spec =
+ dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
+ TemplateArgs = &Spec->getTemplateArgs();
+ return Spec;
+ }
+
return 0;
}
@@ -507,16 +512,7 @@
return;
manglePrefix(DC->getParent());
-
- if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(DC))
- mangleSourceName(Namespace->getIdentifier());
- else if (const RecordDecl *Record = dyn_cast<RecordDecl>(DC)) {
- if (const ClassTemplateSpecializationDecl *D =
- dyn_cast<ClassTemplateSpecializationDecl>(Record)) {
- mangleType(QualType(D->getTypeForDecl(), 0));
- } else
- mangleSourceName(Record->getIdentifier());
- }
+ mangleUnqualifiedName(cast<NamedDecl>(DC));
addSubstitution(cast<NamedDecl>(DC));
}