@@ -845,13 +845,15 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
845
845
if (auto feature = getExperimentalFeature (value)) {
846
846
#ifdef NDEBUG
847
847
if (!isFeatureAvailableInProduction (*feature)) {
848
- llvm::errs () << " error: experimental feature '" << A->getValue ()
849
- << " ' cannot be enabled in a production compiler\n " ;
850
- exit (1 );
848
+ Diags.diagnose (SourceLoc (), diag::experimental_not_supported_in_production,
849
+ A->getValue ());
850
+ HadError = true ;
851
+ } else {
852
+ Opts.Features .insert (*feature);
851
853
}
852
- #endif
853
-
854
+ #else
854
855
Opts.Features .insert (*feature);
856
+ #endif
855
857
}
856
858
857
859
// Hack: In order to support using availability macros in SPM packages, we
@@ -1368,12 +1370,15 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
1368
1370
Opts.BypassResilienceChecks |= Args.hasArg (OPT_bypass_resilience);
1369
1371
1370
1372
if (Opts.hasFeature (Feature::Embedded)) {
1371
- assert (swiftModulesInitialized () && " no SwiftCompilerSources" );
1372
-
1373
1373
Opts.UnavailableDeclOptimizationMode = UnavailableDeclOptimization::Complete;
1374
1374
Opts.DisableImplicitStringProcessingModuleImport = true ;
1375
1375
Opts.DisableImplicitConcurrencyModuleImport = true ;
1376
1376
1377
+ if (!swiftModulesInitialized ()) {
1378
+ Diags.diagnose (SourceLoc (), diag::no_swift_sources_with_embedded);
1379
+ HadError = true ;
1380
+ }
1381
+
1377
1382
if (FrontendOpts.EnableLibraryEvolution ) {
1378
1383
Diags.diagnose (SourceLoc (), diag::evolution_with_embedded);
1379
1384
HadError = true ;
0 commit comments