aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/Mangle.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-09-18 19:44:50 +0000
committerAnders Carlsson <andersca@mac.com>2009-09-18 19:44:50 +0000
commiteafc6dcf670070812a99fcc6db21945a786d9829 (patch)
tree2d06ae44c7027d23a58935eacce81799f35a5464 /lib/CodeGen/Mangle.cpp
parent4bf4e3034e23cc3c177b7c6dda39b28e689e7ed6 (diff)
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
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r--lib/CodeGen/Mangle.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 61b42b9056..5df2a34def 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -262,8 +262,13 @@ static const NamedDecl *isTemplate(const NamedDecl *ND,
}
}
- // 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 @@ void CXXNameMangler::manglePrefix(const DeclContext *DC) {
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));
}