@@ -582,6 +582,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
582
582
DiagnosticEngine &Diags,
583
583
const FrontendOptions &FrontendOpts) {
584
584
using namespace options ;
585
+ bool buildingFromInterface =
586
+ FrontendOptions::doesActionBuildModuleFromInterface (
587
+ FrontendOpts.RequestedAction );
585
588
bool HadError = false ;
586
589
587
590
if (auto A = Args.getLastArg (OPT_swift_version)) {
@@ -791,10 +794,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
791
794
OPT_disable_testable_attr_requires_testable_module)) {
792
795
Opts.EnableTestableAttrRequiresTestableModule
793
796
= A->getOption ().matches (OPT_enable_testable_attr_requires_testable_module);
794
- } else if (FrontendOpts.RequestedAction ==
795
- FrontendOptions::ActionType::TypecheckModuleFromInterface ||
796
- FrontendOpts.RequestedAction ==
797
- FrontendOptions::ActionType::CompileModuleFromInterface) {
797
+ } else if (buildingFromInterface) {
798
798
Opts.EnableObjCAttrRequiresFoundation = false ;
799
799
}
800
800
@@ -873,7 +873,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
873
873
// (non-release) builds for testing purposes.
874
874
if (auto feature = getExperimentalFeature (value)) {
875
875
#ifdef NDEBUG
876
- if (!isFeatureAvailableInProduction (*feature)) {
876
+ if (!buildingFromInterface && ! isFeatureAvailableInProduction (*feature)) {
877
877
Diags.diagnose (SourceLoc (), diag::experimental_not_supported_in_production,
878
878
A->getValue ());
879
879
HadError = true ;
@@ -1142,10 +1142,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
1142
1142
}
1143
1143
// If built from interface, non-resilient access should not be allowed.
1144
1144
if (Opts.AllowNonResilientAccess &&
1145
- (FrontendOpts.RequestedAction ==
1146
- FrontendOptions::ActionType::CompileModuleFromInterface ||
1147
- FrontendOpts.RequestedAction ==
1148
- FrontendOptions::ActionType::TypecheckModuleFromInterface)) {
1145
+ FrontendOptions::doesActionBuildModuleFromInterface (
1146
+ FrontendOpts.RequestedAction )) {
1149
1147
Diags.diagnose (
1150
1148
SourceLoc (), diag::warn_ignore_option_overriden_by,
1151
1149
" -experimental-allow-non-resilient-access" ,
0 commit comments