@@ -1640,46 +1640,23 @@ void CXXNameMangler::mangleUnqualifiedName(
16401640 UnsignedOrNone DeviceNumber =
16411641 Context.getDiscriminatorOverride ()(Context.getASTContext (), Record);
16421642
1643- // If we have a device-number via the discriminator, use that to mangle
1644- // the lambda, otherwise use the typical lambda-mangling-number. In either
1645- // case, a '0' should be mangled as a normal unnamed class instead of as a
1646- // lambda.
1647- if (Record->isLambda () &&
1648- ((DeviceNumber && *DeviceNumber > 0 ) ||
1649- (!DeviceNumber && Record->getLambdaManglingNumber () > 0 ))) {
1643+ if (Record->isLambda ()) {
1644+ assert (!DeviceNumber && Record->getLambdaManglingNumber () > 0 &&
1645+ " Lambda mangling number should be already set" );
16501646 assert (!AdditionalAbiTags &&
16511647 " Lambda type cannot have additional abi tags" );
16521648 mangleLambda (Record);
16531649 break ;
16541650 }
16551651 }
16561652
1657- if (TD->isExternallyVisible ()) {
1658- unsigned UnnamedMangle =
1659- getASTContext ().getManglingNumber (TD, Context.isAux ());
1660- Out << " Ut" ;
1661- if (UnnamedMangle > 1 )
1662- Out << UnnamedMangle - 2 ;
1663- Out << ' _' ;
1664- writeAbiTags (TD, AdditionalAbiTags);
1665- break ;
1666- }
1667-
1668- // Get a unique id for the anonymous struct. If it is not a real output
1669- // ID doesn't matter so use fake one.
1670- unsigned AnonStructId =
1671- NullOut ? 0
1672- : Context.getAnonymousStructId (TD, dyn_cast<FunctionDecl>(DC));
1673-
1674- // Mangle it as a source name in the form
1675- // [n] $_<id>
1676- // where n is the length of the string.
1677- SmallString<8 > Str;
1678- Str += " $_" ;
1679- Str += llvm::utostr (AnonStructId);
1680-
1681- Out << Str.size ();
1682- Out << Str;
1653+ unsigned UnnamedMangle =
1654+ getASTContext ().getManglingNumber (TD, Context.isAux ());
1655+ Out << " Ut" ;
1656+ if (UnnamedMangle > 1 )
1657+ Out << UnnamedMangle - 2 ;
1658+ Out << ' _' ;
1659+ writeAbiTags (TD, AdditionalAbiTags);
16831660 break ;
16841661 }
16851662
0 commit comments