@@ -681,7 +681,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
681
681
Opts.EnablePackageInterfaceLoad = Args.hasArg (OPT_experimental_package_interface_load) ||
682
682
::getenv (" SWIFT_ENABLE_PACKAGE_INTERFACE_LOAD" );
683
683
684
- Opts.EnableBypassResilienceInPackage = Args.hasArg (OPT_experimental_package_bypass_resilience);
684
+ Opts.EnableBypassResilienceInPackage = Args.hasArg (OPT_experimental_package_bypass_resilience) ||
685
+ Opts.hasFeature (Feature::ClientBypassResilientAccessInPackage);
685
686
686
687
Opts.DisableAvailabilityChecking |=
687
688
Args.hasArg (OPT_disable_availability_checking);
@@ -1111,7 +1112,49 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
1111
1112
Opts.EnableIndexingSystemModuleRemarks = Args.hasArg (OPT_remark_indexing_system_module);
1112
1113
1113
1114
Opts.EnableSkipExplicitInterfaceModuleBuildRemarks = Args.hasArg (OPT_remark_skip_explicit_interface_build);
1114
-
1115
+
1116
+ if (Args.hasArg (OPT_enable_library_evolution)) {
1117
+ Opts.SkipNonExportableDecls |=
1118
+ Args.hasArg (OPT_experimental_skip_non_exportable_decls);
1119
+
1120
+ Opts.SkipNonExportableDecls |=
1121
+ Args.hasArg (OPT_experimental_skip_non_inlinable_function_bodies) &&
1122
+ Args.hasArg (OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
1123
+ } else {
1124
+ if (Args.hasArg (OPT_experimental_skip_non_exportable_decls))
1125
+ Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
1126
+ " -experimental-skip-non-exportable-decls" ,
1127
+ " -enable-library-evolution" );
1128
+ }
1129
+
1130
+ Opts.AllowNonResilientAccess = Args.hasArg (OPT_experimental_allow_non_resilient_access) ||
1131
+ Opts.hasFeature (Feature::AllowNonResilientAccessInPackage);
1132
+ if (Opts.AllowNonResilientAccess ) {
1133
+ // Override the option to skip non-exportable decls.
1134
+ if (Opts.SkipNonExportableDecls ) {
1135
+ Diags.diagnose (SourceLoc (), diag::warn_ignore_option_overriden_by,
1136
+ " -experimental-skip-non-exportable-decls" ,
1137
+ " -experimental-allow-non-resilient-access" );
1138
+ Opts.SkipNonExportableDecls = false ;
1139
+ }
1140
+ // If built from interface, non-resilient access should not be allowed.
1141
+ if (Opts.AllowNonResilientAccess &&
1142
+ (FrontendOpts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface ||
1143
+ FrontendOpts.RequestedAction == FrontendOptions::ActionType::TypecheckModuleFromInterface)) {
1144
+ Diags.diagnose (SourceLoc (), diag::warn_ignore_option_overriden_by,
1145
+ " -experimental-allow-non-resilient-access" ,
1146
+ " -compile-module-from-interface or -typecheck-module-from-interface" );
1147
+ Opts.AllowNonResilientAccess = false ;
1148
+ }
1149
+ }
1150
+
1151
+ // HACK: The driver currently erroneously passes all flags to module interface
1152
+ // verification jobs. -experimental-skip-non-exportable-decls is not
1153
+ // appropriate for verification tasks and should be ignored, though.
1154
+ if (FrontendOpts.RequestedAction ==
1155
+ FrontendOptions::ActionType::TypecheckModuleFromInterface)
1156
+ Opts.SkipNonExportableDecls = false ;
1157
+
1115
1158
llvm::Triple Target = Opts.Target ;
1116
1159
StringRef TargetArg;
1117
1160
std::string TargetArgScratch;
@@ -2101,7 +2144,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2101
2144
const FrontendOptions &FEOpts,
2102
2145
const TypeCheckerOptions &TCOpts,
2103
2146
DiagnosticEngine &Diags,
2104
- const llvm::Triple &Triple ,
2147
+ LangOptions &LangOpts ,
2105
2148
ClangImporterOptions &ClangOpts) {
2106
2149
using namespace options ;
2107
2150
@@ -2139,7 +2182,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2139
2182
Opts.SkipFunctionBodies = TCOpts.SkipFunctionBodies ;
2140
2183
2141
2184
// Propagate -experimental-skip-non-exportable-decls to SIL.
2142
- Opts.SkipNonExportableDecls = FEOpts .SkipNonExportableDecls ;
2185
+ Opts.SkipNonExportableDecls = LangOpts .SkipNonExportableDecls ;
2143
2186
2144
2187
// Parse the optimization level.
2145
2188
// Default to Onone settings if no option is passed.
@@ -2346,8 +2389,9 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2346
2389
Opts.CMOMode = CrossModuleOptimizationMode::Everything;
2347
2390
}
2348
2391
2349
- if (Args.hasArg (OPT_ExperimentalPackageCMO)) {
2350
- if (!FEOpts.AllowNonResilientAccess ) {
2392
+ if (Args.hasArg (OPT_ExperimentalPackageCMO) ||
2393
+ LangOpts.hasFeature (Feature::PackageCMO)) {
2394
+ if (!LangOpts.AllowNonResilientAccess ) {
2351
2395
Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
2352
2396
" -experimental-package-cmo" ,
2353
2397
" -experimental-allow-non-resilient-access" );
@@ -2439,7 +2483,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
2439
2483
2440
2484
if (const Arg *A = Args.getLastArg (options::OPT_sanitize_EQ)) {
2441
2485
Opts.Sanitizers = parseSanitizerArgValues (
2442
- Args, A, Triple , Diags,
2486
+ Args, A, LangOpts. Target , Diags,
2443
2487
/* sanitizerRuntimeLibExists= */ [](StringRef libName, bool shared) {
2444
2488
2445
2489
// The driver has checked the existence of the library
@@ -3289,7 +3333,7 @@ bool CompilerInvocation::parseArgs(
3289
3333
3290
3334
if (ParseSILArgs (SILOpts, ParsedArgs, IRGenOpts, FrontendOpts,
3291
3335
TypeCheckerOpts, Diags,
3292
- LangOpts. Target , ClangImporterOpts)) {
3336
+ LangOpts, ClangImporterOpts)) {
3293
3337
return true ;
3294
3338
}
3295
3339
0 commit comments