diff options
author | Eric Christopher <echristo@apple.com> | 2012-03-14 00:25:46 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-03-14 00:25:46 +0000 |
commit | 167174518cc9bdd84b27bfad581028f4092cd68c (patch) | |
tree | 13e1ab4e647afd6de629e319c1c4f1b37375b3f3 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 1cdbfd37d54a9655b4470ff94c9c1b6d9a49e045 (diff) |
Add support to mangle templated member function names with template
args.
Fixes rdar://11042577
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index d88f24339a..0595fdf06b 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -117,12 +117,25 @@ llvm::DIDescriptor CGDebugInfo::getContextDescriptor(const Decl *Context) { StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) { assert (FD && "Invalid FunctionDecl!"); IdentifierInfo *FII = FD->getIdentifier(); - if (FII) + FunctionTemplateSpecializationInfo *Info + = FD->getTemplateSpecializationInfo(); + if (!Info && FII) return FII->getName(); // Otherwise construct human readable name for debug info. std::string NS = FD->getNameAsString(); + // Add any template specialization args. + if (Info) { + const TemplateArgumentList *TArgs = Info->TemplateArguments; + const TemplateArgument *Args = TArgs->data(); + unsigned NumArgs = TArgs->size(); + PrintingPolicy Policy(CGM.getLangOpts()); + NS += TemplateSpecializationType::PrintTemplateArgumentList(Args, + NumArgs, + Policy); + } + // Copy this name on the side and use its reference. char *StrPtr = DebugInfoNames.Allocate<char>(NS.length()); memcpy(StrPtr, NS.data(), NS.length()); |