@@ -1159,19 +1159,20 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
1159
1159
1160
1160
Opts.EnableSkipExplicitInterfaceModuleBuildRemarks = Args.hasArg (OPT_remark_skip_explicit_interface_build);
1161
1161
1162
- if (Args.hasArg (OPT_enable_library_evolution )) {
1163
- Opts. SkipNonExportableDecls |=
1164
- Args. hasArg (OPT_experimental_skip_non_exportable_decls);
1165
-
1166
- Opts. SkipNonExportableDecls |=
1167
- Args. hasArg (OPT_experimental_skip_non_inlinable_function_bodies) &&
1168
- Args.hasArg (
1169
- OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
1170
- } else {
1171
- if (Args. hasArg (OPT_experimental_skip_non_exportable_decls))
1162
+ if (Args.hasArg (OPT_experimental_skip_non_exportable_decls )) {
1163
+ // Only allow -experimental-skip-non-exportable-decls if either library
1164
+ // evolution is enabled (in which case the module's ABI is independent of
1165
+ // internal declarations) or when -experimental-skip-all-function-bodies is
1166
+ // present. The latter implies the module will not be used for code
1167
+ // generation, so omitting details needed for ABI should be safe.
1168
+ if ( Args.hasArg (OPT_enable_library_evolution) ||
1169
+ Args. hasArg (OPT_experimental_skip_all_function_bodies)) {
1170
+ Opts. SkipNonExportableDecls |= true ;
1171
+ } else {
1172
1172
Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1173
1173
" -experimental-skip-non-exportable-decls" ,
1174
1174
" -enable-library-evolution" );
1175
+ }
1175
1176
}
1176
1177
1177
1178
Opts.AllowNonResilientAccess =
@@ -1690,23 +1691,18 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
1690
1691
Opts.DebugGenericSignatures |= Args.hasArg (OPT_debug_generic_signatures);
1691
1692
Opts.DebugInverseRequirements |= Args.hasArg (OPT_debug_inverse_requirements);
1692
1693
1693
- if (Args.hasArg (OPT_enable_library_evolution )) {
1694
- Opts. EnableLazyTypecheck |= Args. hasArg (OPT_experimental_lazy_typecheck);
1695
- Opts. EnableLazyTypecheck |=
1696
- Args. hasArg (OPT_experimental_skip_non_inlinable_function_bodies) &&
1697
- Args.hasArg (
1698
- OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
1699
- } else {
1700
- if (Args. hasArg (OPT_experimental_lazy_typecheck))
1694
+ if (Args.hasArg (OPT_experimental_lazy_typecheck )) {
1695
+ // Same restrictions as -experimental-skip-non-exportable-decls. These
1696
+ // could be relaxed in the future, since lazy typechecking is probably not
1697
+ // inherently unsafe without these options.
1698
+ if ( Args.hasArg (OPT_enable_library_evolution) ||
1699
+ Args. hasArg (OPT_experimental_skip_all_function_bodies)) {
1700
+ Opts. EnableLazyTypecheck |= Args. hasArg (OPT_experimental_lazy_typecheck);
1701
+ } else {
1701
1702
Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1702
1703
" -experimental-lazy-typecheck" ,
1703
1704
" -enable-library-evolution" );
1704
-
1705
- if (Args.hasArg (
1706
- OPT_experimental_skip_non_inlinable_function_bodies_is_lazy))
1707
- Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1708
- " -experimental-skip-non-inlinable-function-bodies-is-lazy" ,
1709
- " -enable-library-evolution" );
1705
+ }
1710
1706
}
1711
1707
1712
1708
// HACK: The driver currently erroneously passes all flags to module interface
0 commit comments