[ABI] mangleCXXCtorVTable mangles an incorrect name
namespace A {
class VBase {
public:
virtual ~VBase() {};
};
struct Wrap {};
template <typename T>
class Impl : public virtual VBase {
public:
};
} // namespace A
struct Inst : public A::Impl<A::Wrap> {};
void Test() { Inst a; }
The code above will generate a CtorVTable with the name _ZTC4Inst0_N1A4ImplINS_4WrapEEE. After demangling, the result is construction vtable for A::Impl<Inst::Wrap>-in-Inst. However, Inst::Wrap is incorrect.
https://github.com/llvm/llvm-project/blob/b0ffaa79050460d724eec1b12363c439b43d5ae5/clang/lib/AST/ItaniumMangle.cpp#L7327-L7338
Because mangleNameOrStandardSubstitution never adds RD as a substitution.
@llvm/issue-subscribers-clang-frontend
Author: tcwzxx (tcwzxx)
namespace A {
class VBase { public: virtual ~VBase() {}; };
struct Wrap {};
template <typename T> class Impl : public virtual VBase { public: };
} // namespace A
struct Inst : public A::Impl<A::Wrap> {};
void Test() { Inst a; }
The code above will generate a `CtorVTable` with the name `_ZTC4Inst0_N1A4ImplINS_4WrapEEE`. After demangling, the result is `construction vtable for A::Impl<Inst::Wrap>-in-Inst`. However, `Inst::Wrap` is incorrect.
https://github.com/llvm/llvm-project/blob/b0ffaa79050460d724eec1b12363c439b43d5ae5/clang/lib/AST/ItaniumMangle.cpp#L7327-L7338
because `mangleNameOrStandardSubstitution` never adds `RD` as a substitution
</details>
For CXXCtorVTable
<special-name> ::= TC <type> <offset number> _ <base type>
I think we should use mangleType instead of mangleNameOrStandardSubstitution.