Skip to content

Commit 606bb39

Browse files
committed
Frontend: Add -experimental-skip-non-inlinable-function-bodies-is-lazy.
This option causes the -experimental-lazy-typecheck and -experimental-skip-non-exportable-decls options to be inferred from the presense of -experimental-skip-non-inlinable-function-bodies. This new option is meant to be a temporary testing aid that allows lazy typechecking to be tested on projects without full build system support for passing the other flags to the right jobs. Resolves rdar://118938251
1 parent 4267ce7 commit 606bb39

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,11 @@ def experimental_skip_all_function_bodies:
11301130
Flag<["-"], "experimental-skip-all-function-bodies">,
11311131
HelpText<"Skip type-checking function bodies and all SIL generation">;
11321132

1133+
def experimental_skip_non_inlinable_function_bodies_is_lazy
1134+
: Flag<["-"], "experimental-skip-non-inlinable-function-bodies-is-lazy">,
1135+
HelpText<"Infer lazy typechecking for "
1136+
"-experimental-skip-non-inlinable-function-bodies">;
1137+
11331138
def experimental_allow_module_with_compiler_errors:
11341139
Flag<["-"], "experimental-allow-module-with-compiler-errors">,
11351140
Flags<[HelpHidden]>,

Diff for: lib/Frontend/ArgsToFrontendOptionsConverter.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ bool ArgsToFrontendOptionsConverter::convert(
322322

323323
Opts.SkipNonExportableDecls |=
324324
Args.hasArg(OPT_experimental_skip_non_exportable_decls);
325+
Opts.SkipNonExportableDecls |=
326+
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies) &&
327+
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
328+
325329
Opts.DebugPrefixSerializedDebuggingOptions |=
326330
Args.hasArg(OPT_prefix_serialized_debugging_options);
327331
Opts.EnableSourceImport |= Args.hasArg(OPT_enable_source_import);

Diff for: lib/Frontend/CompilerInvocation.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,9 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
15031503
Opts.DebugGenericSignatures |= Args.hasArg(OPT_debug_generic_signatures);
15041504

15051505
Opts.EnableLazyTypecheck |= Args.hasArg(OPT_experimental_lazy_typecheck);
1506+
Opts.EnableLazyTypecheck |=
1507+
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies) &&
1508+
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
15061509

15071510
return HadError;
15081511
}

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

+5
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@
1515
// and -experimental-skip-non-exportable-decls can be used by the same client as in (1).
1616
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -enable-library-evolution -parse-as-library -package-name Package -DFLAG -emit-module -emit-module-path %t/lazy-skip-non-inlinable/lazy_typecheck.swiftmodule -debug-forbid-typecheck-prefix NoTypecheck -experimental-lazy-typecheck -experimental-skip-non-inlinable-function-bodies -experimental-skip-non-exportable-decls
1717
// RUN: %target-swift-frontend -package-name Package -typecheck -verify %S/../Inputs/lazy_typecheck_client.swift -DFLAG -I %t/lazy-skip-non-inlinable
18+
19+
// (4) Verify that a module built with -experimental-skip-non-inlinable-function-bodies-is-lazy implies
20+
// -experimental-lazy-typecheck and -experimental-skip-non-exportable-decls.
21+
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -enable-library-evolution -parse-as-library -package-name Package -DFLAG -emit-module -emit-module-path %t/lazy-skip-non-inlinable-is-lazy/lazy_typecheck.swiftmodule -debug-forbid-typecheck-prefix NoTypecheck -experimental-skip-non-inlinable-function-bodies -experimental-skip-non-inlinable-function-bodies-is-lazy
22+
// RUN: %target-swift-frontend -package-name Package -typecheck -verify %S/../Inputs/lazy_typecheck_client.swift -DFLAG -I %t/lazy-skip-non-inlinable-is-lazy

0 commit comments

Comments
 (0)