[clang] [clang] MicrosoftMangle: pick correct tagdecl for mangling tagkind (PR #155662)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 28 10:56:33 PDT 2025


================
@@ -3246,13 +3246,17 @@ void MicrosoftCXXNameMangler::mangleTagTypeKind(TagTypeKind TTK) {
 }
 void MicrosoftCXXNameMangler::mangleType(const EnumType *T, Qualifiers,
                                          SourceRange) {
-  mangleType(cast<TagType>(T)->getOriginalDecl()->getDefinitionOrSelf());
+  mangleType(cast<TagType>(T)->getOriginalDecl());
 }
 void MicrosoftCXXNameMangler::mangleType(const RecordType *T, Qualifiers,
                                          SourceRange) {
-  mangleType(cast<TagType>(T)->getOriginalDecl()->getDefinitionOrSelf());
+  mangleType(cast<TagType>(T)->getOriginalDecl());
 }
 void MicrosoftCXXNameMangler::mangleType(const TagDecl *TD) {
+  // MSVC chooses the tag kind of the definition if it exists, otherwise it
----------------
mizvekov wrote:

Yeah, FWIW these new test cases were confirmed on MSVC.

https://github.com/llvm/llvm-project/pull/155662


More information about the cfe-commits mailing list