[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 25 20:23:35 PDT 2024
================
@@ -7326,11 +7326,13 @@ void ItaniumMangleContextImpl::mangleCXXCtorVTable(const CXXRecordDecl *RD,
raw_ostream &Out) {
// <special-name> ::= TC <type> <offset number> _ <base type>
CXXNameMangler Mangler(*this, Out);
+ QualType RDType = getASTContext().getRecordType(RD);
+ QualType TypeType = getASTContext().getRecordType(Type);
Mangler.getStream() << "_ZTC";
- Mangler.mangleNameOrStandardSubstitution(RD);
+ Mangler.mangleType(RDType);
----------------
tcwzxx wrote:
> I'd prefer we fix `mangleNameOrStandardSubstitution` itself.
> We could rename it to `mangleCXXRecordDecl`, have it take a CXXRecordDecl*, and handle the substitutions there.
> This would avoid the same trap in a potential future user.
After rechecking the code, I found that the users of the `mangleNameOrStandardSubstitution` function are `mangleCXXCtorVTable`, `mangleCXXVTable`, and `mangleCXXVTT`. In the Itanium ABI documentation, these situations are considered as 'Type'. So, maybe we can remove `mangleNameOrStandardSubstitution` and then use `mangleType`.
https://github.com/llvm/llvm-project/pull/109970
More information about the cfe-commits
mailing list