@@ -845,13 +845,15 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
845845 if (auto feature = getExperimentalFeature (value)) {
846846#ifdef NDEBUG
847847 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);
851853 }
852- #endif
853-
854+ #else
854855 Opts.Features .insert (*feature);
856+ #endif
855857 }
856858
857859 // Hack: In order to support using availability macros in SPM packages, we
@@ -1368,12 +1370,15 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
13681370 Opts.BypassResilienceChecks |= Args.hasArg (OPT_bypass_resilience);
13691371
13701372 if (Opts.hasFeature (Feature::Embedded)) {
1371- assert (swiftModulesInitialized () && " no SwiftCompilerSources" );
1372-
13731373 Opts.UnavailableDeclOptimizationMode = UnavailableDeclOptimization::Complete;
13741374 Opts.DisableImplicitStringProcessingModuleImport = true ;
13751375 Opts.DisableImplicitConcurrencyModuleImport = true ;
13761376
1377+ if (!swiftModulesInitialized ()) {
1378+ Diags.diagnose (SourceLoc (), diag::no_swift_sources_with_embedded);
1379+ HadError = true ;
1380+ }
1381+
13771382 if (FrontendOpts.EnableLibraryEvolution ) {
13781383 Diags.diagnose (SourceLoc (), diag::evolution_with_embedded);
13791384 HadError = true ;
0 commit comments