[MS Demangler] Print template constructor args.

Previously if you had something like this:

template<typename T>
struct Foo {
  template<typename U>
  Foo(U);
};

Foo F(3.7);

this would mangle as ??$?0N@?$Foo@H@@QEAA@N@Z

and this would be demangled as:

undname:      __cdecl Foo<int>::Foo<int><double>(double)
llvm-undname: __cdecl Foo<int>::Foo<int>(double)

Note the lack of the constructor template parameter in our
demangling.

This patch makes it so we print the constructor argument list.

llvm-svn: 340356
This commit is contained in:
Zachary Turner 2018-08-21 22:52:52 +00:00
parent 986f03c2ea
commit ee09170d25
2 changed files with 16 additions and 0 deletions

View File

@ -969,7 +969,20 @@ static void outputName(OutputStream &OS, const Name *TheName, const Type *Ty) {
OS << "~";
LLVM_FALLTHROUGH;
case OperatorTy::Ctor:
// Output the class name with template arguments a second time.
outputNameComponent(OS, *Previous);
// Structors don't have a name, so outputting the name here actually is a
// no-op. But for template constructors, it needs to output the template
// argument list. e.g.
//
// template<typename T>
// struct Foo {
// template<typename U>
// Foo(U);
// };
// should demangle as -- for example -- Foo<int><double>(double);
outputNameComponent(OS, *TheName);
break;
case OperatorTy::Conversion:
OS << "operator";

View File

@ -196,3 +196,6 @@
??$f@US@@$1?g@1@QEAAXXZ@@YAXXZ
; CHECK: void __cdecl f<struct S, &void __cdecl S::g(void)>(void)
??$?0N@?$Foo@H@@QEAA@N@Z
; CHECK: __cdecl Foo<int>::Foo<int><double>(double)