Frontend: Ignore lazy typechecking flags when emitting non-resilient modules.

The `-experimental-lazy-typecheck` and `-experimental-skip-non-exportable-decls`
flags are not safe to use when emitting a non-resilient module because the
clients of non-resilient modules expect to have access to all the members of a
type in order to e.g. compute the size the type. The
`-experimental-skip-non-exportable-decls` flag skips serialization of
non-public members and would therefore cause mis-compilation. The
`-experimental-lazy-typecheck` is theoretically safe for non-resilient modules
but more requestification work is needed before it can be used successfully.

Resolves rdar://122272758
This commit is contained in:
Allan Shortlidge
2024-02-04 08:12:25 -08:00
parent 2fa1022a91
commit 67661ccf93
8 changed files with 71 additions and 42 deletions

View File

@@ -1523,10 +1523,25 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
Opts.DebugGenericSignatures |= Args.hasArg(OPT_debug_generic_signatures);
Opts.DebugInverseRequirements |= Args.hasArg(OPT_debug_inverse_requirements);
Opts.EnableLazyTypecheck |= Args.hasArg(OPT_experimental_lazy_typecheck);
Opts.EnableLazyTypecheck |=
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies) &&
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
if (Args.hasArg(OPT_enable_library_evolution)) {
Opts.EnableLazyTypecheck |= Args.hasArg(OPT_experimental_lazy_typecheck);
Opts.EnableLazyTypecheck |=
Args.hasArg(OPT_experimental_skip_non_inlinable_function_bodies) &&
Args.hasArg(
OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
} else {
if (Args.hasArg(OPT_experimental_lazy_typecheck))
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
"-experimental-lazy-typecheck",
"-enable-library-evolution");
if (Args.hasArg(
OPT_experimental_skip_non_inlinable_function_bodies_is_lazy))
Diags.diagnose(SourceLoc(), diag::ignoring_option_requires_option,
"-experimental-skip-non-inlinable-function-bodies-is-lazy",
"-enable-library-evolution");
}
// HACK: The driver currently erroneously passes all flags to module interface
// verification jobs. -experimental-skip-non-exportable-decls is not
// appropriate for verification tasks and should be ignored, though.