[clang] [ItaniumMangle] Use mangleType instead of mangleNameOrStandardSubstitution in mangleCXXCtorVTable function (PR #109970)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 25 09:39:55 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);
----------------
mizvekov wrote:
The only difference here is whether we perform / add a substitution for RD.
We only ever see a problem for `mangleCXXCtorVTable` because it's the only user of `mangleNameOrStandardSubstitution` which mangles anything at all after a call to that function.
I can't find this production in the ItaniumABI docs, but if the comment is right, I think performing this substitution is correct.
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.
CC @rjmccall @zygoloid
https://github.com/llvm/llvm-project/pull/109970
More information about the cfe-commits
mailing list