From: David Majnemer Date: Sun, 25 Dec 2016 05:26:02 +0000 (+0000) Subject: [MS ABI] Mangle unnamed enums correctly X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee97307fb8860b4f721fce8f1a919995452366a4;p=clang [MS ABI] Mangle unnamed enums correctly Unnamed enums take the name of the first enumerator they define. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290509 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 27806a7d9e..911b8b471a 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -863,21 +863,28 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND, } } - llvm::SmallString<64> Name(" Name; if (DeclaratorDecl *DD = Context.getASTContext().getDeclaratorForUnnamedTagDecl(TD)) { // Anonymous types without a name for linkage purposes have their // declarator mangled in if they have one. + Name += "getName(); } else if (TypedefNameDecl *TND = Context.getASTContext().getTypedefNameForUnnamedTagDecl( TD)) { // Anonymous types without a name for linkage purposes have their // associate typedef mangled in if they have one. + Name += "getName(); + } else if (auto *ED = dyn_cast(TD)) { + auto EnumeratorI = ED->enumerator_begin(); + assert(EnumeratorI != ED->enumerator_end()); + Name += "getName(); } else { // Otherwise, number the types using a $S prefix. - Name += "$S"; + Name += "@@@Z"(