@@ -219,8 +219,8 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
219219 bool useExportedModuleNames,
220220 bool aliasModuleNames,
221221 llvm::SmallSet<StringRef, 4 >
222- *aliasModuleNamesTargets,
223- bool abiComments ) {
222+ *aliasModuleNamesTargets
223+ ) {
224224 PrintOptions result;
225225 result.IsForSwiftInterface = true ;
226226 result.PrintLongAttrsOnSeparateLines = true ;
@@ -242,7 +242,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
242242 result.PreferTypeRepr = preferTypeRepr;
243243 result.AliasModuleNames = aliasModuleNames;
244244 result.AliasModuleNamesTargets = aliasModuleNamesTargets;
245- result.PrintABIComments = abiComments;
246245 if (printFullConvention)
247246 result.PrintFunctionRepresentationAttrs =
248247 PrintOptions::FunctionRepresentationMode::Full;
@@ -783,28 +782,19 @@ class PrintAST : public ASTVisitor<PrintAST> {
783782 printRawComment (RC);
784783 }
785784
786- // / If we should print a mangled name for this declaration, return that
787- // / mangled name.
788- std::optional<std::string> mangledNameToPrint (const Decl *D);
789-
790785 void printDocumentationComment (const Decl *D) {
791- if (Options.PrintDocumentationComments ) {
792- // Try to print a comment from Clang.
793- auto MaybeClangNode = D->getClangNode ();
794- if (MaybeClangNode) {
795- if (auto *CD = MaybeClangNode.getAsDecl ())
796- printClangDocumentationComment (CD);
797- return ;
798- }
786+ if (!Options.PrintDocumentationComments )
787+ return ;
799788
800- printSwiftDocumentationComment (D);
789+ // Try to print a comment from Clang.
790+ auto MaybeClangNode = D->getClangNode ();
791+ if (MaybeClangNode) {
792+ if (auto *CD = MaybeClangNode.getAsDecl ())
793+ printClangDocumentationComment (CD);
794+ return ;
801795 }
802796
803- if (auto mangledName = mangledNameToPrint (D)) {
804- indent ();
805- Printer << " // MANGLED NAME: " << *mangledName;
806- Printer.printNewline ();
807- }
797+ printSwiftDocumentationComment (D);
808798 }
809799
810800 void printStaticKeyword (StaticSpellingKind StaticSpelling) {
@@ -3130,58 +3120,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
31303120 }
31313121}
31323122
3133- std::optional<std::string> PrintAST::mangledNameToPrint (const Decl *D) {
3134- using ASTMangler = Mangle::ASTMangler;
3135-
3136- if (!Options.PrintABIComments )
3137- return std::nullopt ;
3138-
3139- auto valueDecl = dyn_cast<ValueDecl>(D);
3140- if (!valueDecl)
3141- return std::nullopt ;
3142-
3143- // Anything with an access level less than "package" isn't meant to be
3144- // referenced from source code outside the module.
3145- if (valueDecl->getEffectiveAccess () < AccessLevel::Package)
3146- return std::nullopt ;
3147-
3148- // For functions, mangle the entity directly.
3149- if (auto func = dyn_cast<FuncDecl>(D)) {
3150- ASTMangler mangler;
3151- return mangler.mangleEntity (func);
3152- }
3153-
3154- // For initializers, mangle the allocating initializer.
3155- if (auto init = dyn_cast<ConstructorDecl>(D)) {
3156- ASTMangler mangler;
3157- return mangler.mangleConstructorEntity (init, /* isAllocating=*/ true );
3158- }
3159-
3160- // For variables, mangle the entity directly.
3161- if (auto var = dyn_cast<VarDecl>(D)) {
3162- ASTMangler mangler;
3163- return mangler.mangleEntity (var);
3164- }
3165-
3166- // For subscripts, mangle the entity directly.
3167- if (auto subscript = dyn_cast<SubscriptDecl>(D)) {
3168- ASTMangler mangler;
3169- return mangler.mangleEntity (subscript);
3170- }
3171-
3172- // For nominal types, mangle the type metadata accessor.
3173- if (auto nominal = dyn_cast<NominalTypeDecl>(D)) {
3174- if (!isa<ProtocolDecl>(nominal) && !nominal->getGenericSignature ()) {
3175- ASTMangler mangler;
3176- std::string name = mangler.mangleNominalType (nominal);
3177- name += " Ma" ;
3178- return name;
3179- }
3180- }
3181-
3182- return std::nullopt ;
3183- }
3184-
31853123static void suppressingFeatureIsolatedAny (PrintOptions &options,
31863124 llvm::function_ref<void ()> action) {
31873125 llvm::SaveAndRestore<bool > scope (options.SuppressIsolatedAny , true );
0 commit comments