Skip to content

Commit d967b18

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents 1d64f9f + 5b632bd commit d967b18

12 files changed

+25
-25
lines changed

Diff for: include/swift/AST/SILOptions.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,12 @@ class SILOptions {
183183
/// when possible.
184184
bool EnablePackMetadataStackPromotion = true;
185185

186-
// The kind of function bodies to skip emitting.
186+
/// The kind of function bodies to skip emitting.
187187
FunctionBodySkipping SkipFunctionBodies = FunctionBodySkipping::None;
188188

189+
/// Whether to skip declarations that are internal to the module.
190+
bool SkipNonExportableDecls = false;
191+
189192
/// Optimization mode being used.
190193
OptimizationMode OptMode = OptimizationMode::NotSet;
191194

Diff for: include/swift/Frontend/FrontendOptions.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,8 @@ class FrontendOptions {
335335
/// times) when compiling a module interface?
336336
bool SerializeModuleInterfaceDependencyHashes = false;
337337

338-
/// Should we only serialize decls that may be referenced externally in the
339-
/// binary module?
340-
bool SerializeExternalDeclsOnly = false;
338+
/// Should we skip decls that cannot be referenced externally?
339+
bool SkipNonExportableDecls = false;
341340

342341
/// Should we warn if an imported module needed to be rebuilt from a
343342
/// module interface file?

Diff for: include/swift/Option/FrontendOptions.td

+4-4
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,6 @@ def serialize_debugging_options : Flag<["-"], "serialize-debugging-options">,
197197
def serialized_path_obfuscate : Separate<["-"], "serialized-path-obfuscate">,
198198
HelpText<"Remap source paths in debug info">, MetaVarName<"<prefix=replacement>">;
199199

200-
def experimental_serialize_external_decls_only
201-
: Flag<["-"], "experimental-serialize-external-decls-only">,
202-
HelpText<"Only serialize decls that should be exposed to clients">;
203-
204200
def empty_abi_descriptor : Flag<["-"], "empty-abi-descriptor">,
205201
HelpText<"Avoid printing actual module content into ABI descriptor file">;
206202

@@ -1135,6 +1131,10 @@ def experimental_allow_module_with_compiler_errors:
11351131
Flags<[HelpHidden]>,
11361132
HelpText<"Attempt to output .swiftmodule, regardless of compilation errors">;
11371133

1134+
def experimental_skip_non_exportable_decls
1135+
: Flag<["-"], "experimental-skip-non-exportable-decls">,
1136+
HelpText<"Skip decls that are not exported to clients">;
1137+
11381138
def bad_file_descriptor_retry_count:
11391139
Separate<["-"], "bad-file-descriptor-retry-count">,
11401140
HelpText<"Number of retrying opening a file if previous open returns a bad "

Diff for: include/swift/Serialization/SerializationOptions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace swift {
157157
bool HermeticSealAtLink = false;
158158
bool EmbeddedSwiftModule = false;
159159
bool IsOSSA = false;
160-
bool SerializeExternalDeclsOnly = false;
160+
bool SkipNonExportableDecls = false;
161161
};
162162

163163
} // end namespace swift

Diff for: lib/Frontend/ArgsToFrontendOptionsConverter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ bool ArgsToFrontendOptionsConverter::convert(
320320
A->getOption().matches(OPT_serialize_debugging_options);
321321
}
322322

323-
Opts.SerializeExternalDeclsOnly |=
324-
Args.hasArg(OPT_experimental_serialize_external_decls_only);
323+
Opts.SkipNonExportableDecls |=
324+
Args.hasArg(OPT_experimental_skip_non_exportable_decls);
325325
Opts.DebugPrefixSerializedDebuggingOptions |=
326326
Args.hasArg(OPT_prefix_serialized_debugging_options);
327327
Opts.EnableSourceImport |= Args.hasArg(OPT_enable_source_import);

Diff for: lib/Frontend/CompilerInvocation.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,9 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
20032003
// -experimental-skip-*-function-bodies to SIL.
20042004
Opts.SkipFunctionBodies = TCOpts.SkipFunctionBodies;
20052005

2006+
// Propagate -experimental-skip-non-exportable-decls to SIL.
2007+
Opts.SkipNonExportableDecls = FEOpts.SkipNonExportableDecls;
2008+
20062009
// Parse the optimization level.
20072010
// Default to Onone settings if no option is passed.
20082011
Opts.OptMode = OptimizationMode::NoOptimization;

Diff for: lib/Frontend/Frontend.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
238238

239239
serializationOpts.IsOSSA = getSILOptions().EnableOSSAModules;
240240

241-
serializationOpts.SerializeExternalDeclsOnly =
242-
opts.SerializeExternalDeclsOnly;
241+
serializationOpts.SkipNonExportableDecls = opts.SkipNonExportableDecls;
243242

244243
return serializationOpts;
245244
}

Diff for: lib/Serialization/Serialization.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -4869,12 +4869,11 @@ static bool canSkipWhenInvalid(const Decl *D) {
48694869
}
48704870

48714871
bool Serializer::shouldSkipDecl(const Decl *D) const {
4872-
// The presence of -experimental-serialize-external-decls-only is the only
4872+
// The presence of -experimental-skip-non-exportable-decls is the only
48734873
// reason to omit decls during serialization.
4874-
if (!Options.SerializeExternalDeclsOnly)
4874+
if (!Options.SkipNonExportableDecls)
48754875
return false;
48764876

4877-
// For our purposes, "deserialization safe" is the same thing as "external".
48784877
if (DeclSerializer::isDeserializationSafe(D))
48794878
return false;
48804879

Diff for: test/SILGen/Inputs/open_enum.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
typedef enum __attribute__((enum_extensibility(open))) YesOrNo {
2+
typedef enum __attribute__((enum_extensibility(open))) YesOrNo : int {
33
Yes,
44
No,
55
} YesOrNo;

Diff for: test/SILGen/skip-function-bodies-clang-enum-init-raw-value.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
// RUN: %target-swift-frontend -emit-silgen %s -import-objc-header %S/Inputs/open_enum.h -experimental-skip-non-inlinable-function-bodies-without-types | %FileCheck %s
44
// RUN: %target-swift-frontend -emit-silgen %s -import-objc-header %S/Inputs/open_enum.h -debug-forbid-typecheck-prefix SKIP_ALL_NO_TYPECHECK -experimental-skip-all-function-bodies | %FileCheck %s --check-prefix=CHECK-SKIP-ALL
55

6-
// Imported clang enums have different signedness when building for Windows.
7-
// UNSUPPORTED: OS=windows-msvc
8-
96
// CHECK-SKIP-ALL-NOT: s4main13inlinableFuncSo7YesOrNoVyF
107

118
// CHECK: sil [serialized]{{.*}} @$s4main13inlinableFuncSo7YesOrNoVyF : $@convention(thin) () -> YesOrNo {
@@ -17,8 +14,8 @@
1714
return YesOrNo(rawValue: 1)!
1815
}
1916

20-
// CHECK-SKIP-ALL-NOT: sSo7YesOrNoV8rawValueABSgs6UInt32V_tcfC
17+
// CHECK-SKIP-ALL-NOT: sSo7YesOrNoV8rawValueABSgs5Int32V_tcfC
2118

22-
// CHECK: sil shared [serialized]{{.*}} @$sSo7YesOrNoV8rawValueABSgs6UInt32V_tcfC : $@convention(method) (UInt32, @thin YesOrNo.Type) -> Optional<YesOrNo> {
19+
// CHECK: sil shared [serialized]{{.*}} @$sSo7YesOrNoV8rawValueABSgs5Int32V_tcfC : $@convention(method) (Int32, @thin YesOrNo.Type) -> Optional<YesOrNo> {
2320
// CHECK: return {{%.*}} : $Optional<YesOrNo>
24-
// CHECK: } // end sil function '$sSo7YesOrNoV8rawValueABSgs6UInt32V_tcfC'
21+
// CHECK: } // end sil function '$sSo7YesOrNoV8rawValueABSgs5Int32V_tcfC'

Diff for: test/Serialization/serialize-external-decls-only-lazy-typecheck.swift renamed to test/Serialization/lazy-typecheck.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -enable-library-evolution -parse-as-library -package-name Package -DFLAG -typecheck -verify
3-
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path %t/lazy_typecheck.swiftmodule -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-serialize-external-decls-only
3+
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path %t/lazy_typecheck.swiftmodule -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-skip-non-exportable-decls
44

55
// RUN: %target-swift-frontend -package-name Package -typecheck -verify %S/../Inputs/lazy_typecheck_client.swift -DFLAG -I %t
66

Diff for: test/TBD/lazy-typecheck.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
33

4-
// RUN: %target-swift-frontend -target arm64-apple-macosx10.13 -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path /dev/null -emit-tbd-path %t/lazy_typecheck.tbd -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-serialize-external-decls-only
4+
// RUN: %target-swift-frontend -target arm64-apple-macosx10.13 -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path /dev/null -emit-tbd-path %t/lazy_typecheck.tbd -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-skip-non-exportable-decls
55
// RUN: %llvm-readtapi %t/lazy_typecheck.tbd %t/expected.tbd
66

77
// REQUIRES: OS=macosx

0 commit comments

Comments
 (0)