@@ -1154,19 +1154,20 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
1154
1154
1155
1155
Opts.EnableSkipExplicitInterfaceModuleBuildRemarks = Args.hasArg (OPT_remark_skip_explicit_interface_build);
1156
1156
1157
- if (Args.hasArg (OPT_enable_library_evolution )) {
1158
- Opts. SkipNonExportableDecls |=
1159
- Args. hasArg (OPT_experimental_skip_non_exportable_decls);
1160
-
1161
- Opts. SkipNonExportableDecls |=
1162
- Args. hasArg (OPT_experimental_skip_non_inlinable_function_bodies) &&
1163
- Args.hasArg (
1164
- OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
1165
- } else {
1166
- if (Args. hasArg (OPT_experimental_skip_non_exportable_decls))
1157
+ if (Args.hasArg (OPT_experimental_skip_non_exportable_decls )) {
1158
+ // Only allow -experimental-skip-non-exportable-decls if either library
1159
+ // evolution is enabled (in which case the module's ABI is independent of
1160
+ // internal declarations) or when -experimental-skip-all-function-bodies is
1161
+ // present. The latter implies the module will not be used for code
1162
+ // generation, so omitting details needed for ABI should be safe.
1163
+ if ( Args.hasArg (OPT_enable_library_evolution) ||
1164
+ Args. hasArg (OPT_experimental_skip_all_function_bodies)) {
1165
+ Opts. SkipNonExportableDecls |= true ;
1166
+ } else {
1167
1167
Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1168
1168
" -experimental-skip-non-exportable-decls" ,
1169
1169
" -enable-library-evolution" );
1170
+ }
1170
1171
}
1171
1172
1172
1173
Opts.AllowNonResilientAccess =
@@ -1712,23 +1713,18 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
1712
1713
Opts.DebugGenericSignatures |= Args.hasArg (OPT_debug_generic_signatures);
1713
1714
Opts.DebugInverseRequirements |= Args.hasArg (OPT_debug_inverse_requirements);
1714
1715
1715
- if (Args.hasArg (OPT_enable_library_evolution )) {
1716
- Opts. EnableLazyTypecheck |= Args. hasArg (OPT_experimental_lazy_typecheck);
1717
- Opts. EnableLazyTypecheck |=
1718
- Args. hasArg (OPT_experimental_skip_non_inlinable_function_bodies) &&
1719
- Args.hasArg (
1720
- OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
1721
- } else {
1722
- if (Args. hasArg (OPT_experimental_lazy_typecheck))
1716
+ if (Args.hasArg (OPT_experimental_lazy_typecheck )) {
1717
+ // Same restrictions as -experimental-skip-non-exportable-decls. These
1718
+ // could be relaxed in the future, since lazy typechecking is probably not
1719
+ // inherently unsafe without these options.
1720
+ if ( Args.hasArg (OPT_enable_library_evolution) ||
1721
+ Args. hasArg (OPT_experimental_skip_all_function_bodies)) {
1722
+ Opts. EnableLazyTypecheck |= Args. hasArg (OPT_experimental_lazy_typecheck);
1723
+ } else {
1723
1724
Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1724
1725
" -experimental-lazy-typecheck" ,
1725
1726
" -enable-library-evolution" );
1726
-
1727
- if (Args.hasArg (
1728
- OPT_experimental_skip_non_inlinable_function_bodies_is_lazy))
1729
- Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1730
- " -experimental-skip-non-inlinable-function-bodies-is-lazy" ,
1731
- " -enable-library-evolution" );
1727
+ }
1732
1728
}
1733
1729
1734
1730
if (LangOpts.AllowNonResilientAccess &&
0 commit comments