@@ -201,8 +201,8 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
201
201
bool useExportedModuleNames,
202
202
bool aliasModuleNames,
203
203
llvm::SmallSet<StringRef, 4 >
204
- *aliasModuleNamesTargets,
205
- bool abiComments ) {
204
+ *aliasModuleNamesTargets
205
+ ) {
206
206
PrintOptions result;
207
207
result.IsForSwiftInterface = true ;
208
208
result.PrintLongAttrsOnSeparateLines = true ;
@@ -224,7 +224,6 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
224
224
result.PreferTypeRepr = preferTypeRepr;
225
225
result.AliasModuleNames = aliasModuleNames;
226
226
result.AliasModuleNamesTargets = aliasModuleNamesTargets;
227
- result.PrintABIComments = abiComments;
228
227
if (printFullConvention)
229
228
result.PrintFunctionRepresentationAttrs =
230
229
PrintOptions::FunctionRepresentationMode::Full;
@@ -765,28 +764,19 @@ class PrintAST : public ASTVisitor<PrintAST> {
765
764
printRawComment (RC);
766
765
}
767
766
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
-
772
767
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 ;
781
770
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 ;
783
777
}
784
778
785
- if (auto mangledName = mangledNameToPrint (D)) {
786
- indent ();
787
- Printer << " // MANGLED NAME: " << *mangledName;
788
- Printer.printNewline ();
789
- }
779
+ printSwiftDocumentationComment (D);
790
780
}
791
781
792
782
void printStaticKeyword (StaticSpellingKind StaticSpelling) {
@@ -3114,58 +3104,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
3114
3104
}
3115
3105
}
3116
3106
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
-
3169
3107
static void suppressingFeatureIsolatedAny (PrintOptions &options,
3170
3108
llvm::function_ref<void ()> action) {
3171
3109
llvm::SaveAndRestore<bool > scope (options.SuppressIsolatedAny , true );
0 commit comments