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