@@ -201,8 +201,8 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
201201 bool useExportedModuleNames,
202202 bool aliasModuleNames,
203203 llvm::SmallSet<StringRef, 4 >
204- *aliasModuleNamesTargets,
205- bool abiComments ) {
204+ *aliasModuleNamesTargets
205+ ) {
206206 PrintOptions result;
207207 result.IsForSwiftInterface = true ;
208208 result.PrintLongAttrsOnSeparateLines = true ;
@@ -224,7 +224,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
224224 result.PreferTypeRepr = preferTypeRepr;
225225 result.AliasModuleNames = aliasModuleNames;
226226 result.AliasModuleNamesTargets = aliasModuleNamesTargets;
227- result.PrintABIComments = abiComments;
228227 if (printFullConvention)
229228 result.PrintFunctionRepresentationAttrs =
230229 PrintOptions::FunctionRepresentationMode::Full;
@@ -765,28 +764,19 @@ class PrintAST : public ASTVisitor<PrintAST> {
765764 printRawComment (RC);
766765 }
767766
768- // / If we should print a mangled name for this declaration, return that
769- // / mangled name.
770- std::optional<std::string> mangledNameToPrint (const Decl *D);
771-
772767 void printDocumentationComment (const Decl *D) {
773- if (Options.PrintDocumentationComments ) {
774- // Try to print a comment from Clang.
775- auto MaybeClangNode = D->getClangNode ();
776- if (MaybeClangNode) {
777- if (auto *CD = MaybeClangNode.getAsDecl ())
778- printClangDocumentationComment (CD);
779- return ;
780- }
768+ if (!Options.PrintDocumentationComments )
769+ return ;
781770
782- printSwiftDocumentationComment (D);
771+ // Try to print a comment from Clang.
772+ auto MaybeClangNode = D->getClangNode ();
773+ if (MaybeClangNode) {
774+ if (auto *CD = MaybeClangNode.getAsDecl ())
775+ printClangDocumentationComment (CD);
776+ return ;
783777 }
784778
785- if (auto mangledName = mangledNameToPrint (D)) {
786- indent ();
787- Printer << " // MANGLED NAME: " << *mangledName;
788- Printer.printNewline ();
789- }
779+ printSwiftDocumentationComment (D);
790780 }
791781
792782 void printStaticKeyword (StaticSpellingKind StaticSpelling) {
@@ -3114,58 +3104,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
31143104 }
31153105}
31163106
3117- std::optional<std::string> PrintAST::mangledNameToPrint (const Decl *D) {
3118- using ASTMangler = Mangle::ASTMangler;
3119-
3120- if (!Options.PrintABIComments )
3121- return std::nullopt ;
3122-
3123- auto valueDecl = dyn_cast<ValueDecl>(D);
3124- if (!valueDecl)
3125- return std::nullopt ;
3126-
3127- // Anything with an access level less than "package" isn't meant to be
3128- // referenced from source code outside the module.
3129- if (valueDecl->getEffectiveAccess () < AccessLevel::Package)
3130- return std::nullopt ;
3131-
3132- // For functions, mangle the entity directly.
3133- if (auto func = dyn_cast<FuncDecl>(D)) {
3134- ASTMangler mangler;
3135- return mangler.mangleEntity (func);
3136- }
3137-
3138- // For initializers, mangle the allocating initializer.
3139- if (auto init = dyn_cast<ConstructorDecl>(D)) {
3140- ASTMangler mangler;
3141- return mangler.mangleConstructorEntity (init, /* isAllocating=*/ true );
3142- }
3143-
3144- // For variables, mangle the entity directly.
3145- if (auto var = dyn_cast<VarDecl>(D)) {
3146- ASTMangler mangler;
3147- return mangler.mangleEntity (var);
3148- }
3149-
3150- // For subscripts, mangle the entity directly.
3151- if (auto subscript = dyn_cast<SubscriptDecl>(D)) {
3152- ASTMangler mangler;
3153- return mangler.mangleEntity (subscript);
3154- }
3155-
3156- // For nominal types, mangle the type metadata accessor.
3157- if (auto nominal = dyn_cast<NominalTypeDecl>(D)) {
3158- if (!isa<ProtocolDecl>(nominal) && !nominal->getGenericSignature ()) {
3159- ASTMangler mangler;
3160- std::string name = mangler.mangleNominalType (nominal);
3161- name += " Ma" ;
3162- return name;
3163- }
3164- }
3165-
3166- return std::nullopt ;
3167- }
3168-
31693107static void suppressingFeatureIsolatedAny (PrintOptions &options,
31703108 llvm::function_ref<void ()> action) {
31713109 llvm::SaveAndRestore<bool > scope (options.SuppressIsolatedAny , true );
0 commit comments