@@ -4359,6 +4359,20 @@ int main(int argc, char *argv[]) {
43594359 for (auto &File : options::InputFilenames)
43604360 InitInvok.getFrontendOptions ().InputsAndOutputs .addInputFile (File);
43614361
4362+ for (const auto &featureArg : options::EnableExperimentalFeatures) {
4363+ if (auto feature = getExperimentalFeature (featureArg)) {
4364+ InitInvok.getLangOptions ().Features .insert (*feature);
4365+ }
4366+ }
4367+
4368+ for (const auto &featureArg : options::EnableUpcomingFeatures) {
4369+ if (auto feature = getUpcomingFeature (featureArg)) {
4370+ InitInvok.getLangOptions ().Features .insert (*feature);
4371+ }
4372+ }
4373+
4374+ // NOTE: 'setMainExecutablePath' must be after 'Features' because
4375+ // 'setRuntimeResourcePath()' called from here depends on 'Features'.
43624376 InitInvok.setMainExecutablePath (mainExecutablePath);
43634377 InitInvok.setModuleName (options::ModuleName);
43644378
@@ -4428,18 +4442,6 @@ int main(int argc, char *argv[]) {
44284442 InitInvok.getLangOptions ().EnableExperimentalStringProcessing = true ;
44294443 }
44304444
4431- for (const auto &featureArg : options::EnableExperimentalFeatures) {
4432- if (auto feature = getExperimentalFeature (featureArg)) {
4433- InitInvok.getLangOptions ().Features .insert (*feature);
4434- }
4435- }
4436-
4437- for (const auto &featureArg : options::EnableUpcomingFeatures) {
4438- if (auto feature = getUpcomingFeature (featureArg)) {
4439- InitInvok.getLangOptions ().Features .insert (*feature);
4440- }
4441- }
4442-
44434445 if (!options::Triple.empty ())
44444446 InitInvok.setTargetTriple (options::Triple);
44454447 if (!options::SwiftVersion.empty ()) {
0 commit comments