File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed
include/swift/Serialization Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ class SerializationOptions {
163163 bool HermeticSealAtLink = false ;
164164 bool EmbeddedSwiftModule = false ;
165165 bool SkipNonExportableDecls = false ;
166+ bool SkipImplementationOnlyDecls = false ;
166167 bool ExplicitModuleBuild = false ;
167168 bool EnableSerializationRemarks = false ;
168169 bool IsInterfaceSDKRelative = false ;
Original file line number Diff line number Diff line change @@ -284,6 +284,9 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
284284 serializationOpts.SkipNonExportableDecls =
285285 getLangOptions ().SkipNonExportableDecls ;
286286
287+ serializationOpts.SkipImplementationOnlyDecls =
288+ getLangOptions ().hasFeature (Feature::CheckImplementationOnly);
289+
287290 serializationOpts.ExplicitModuleBuild = FrontendOpts.DisableImplicitModules ;
288291
289292 serializationOpts.EnableSerializationRemarks =
Original file line number Diff line number Diff line change @@ -5390,6 +5390,20 @@ bool Serializer::shouldSkipDecl(const Decl *D) const {
53905390void Serializer::writeASTBlockEntity (const Decl *D) {
53915391 using namespace decls_block ;
53925392
5393+ if (Options.SkipImplementationOnlyDecls ) {
5394+ // Skip @_implementationOnly types.
5395+ if (D->getAttrs ().hasAttribute <ImplementationOnlyAttr>())
5396+ return ;
5397+
5398+ // Skip non-public @export(interface) functions.
5399+ auto FD = dyn_cast<AbstractFunctionDecl>(D);
5400+ if (FD &&
5401+ FD->getAttrs ().hasAttribute <NeverEmitIntoClientAttr>() &&
5402+ !FD->getFormalAccessScope (/* useDC*/ nullptr ,
5403+ /* treatUsableFromInlineAsPublic*/ true ).isPublicOrPackage ())
5404+ return ;
5405+ }
5406+
53935407 PrettyStackTraceDecl trace (" serializing" , D);
53945408 assert (DeclsToSerialize.hasRef (D));
53955409
You can’t perform that action at this time.
0 commit comments