@@ -4359,6 +4359,20 @@ int main(int argc, char *argv[]) {
4359
4359
for (auto &File : options::InputFilenames)
4360
4360
InitInvok.getFrontendOptions ().InputsAndOutputs .addInputFile (File);
4361
4361
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'.
4362
4376
InitInvok.setMainExecutablePath (mainExecutablePath);
4363
4377
InitInvok.setModuleName (options::ModuleName);
4364
4378
@@ -4428,18 +4442,6 @@ int main(int argc, char *argv[]) {
4428
4442
InitInvok.getLangOptions ().EnableExperimentalStringProcessing = true ;
4429
4443
}
4430
4444
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
-
4443
4445
if (!options::Triple.empty ())
4444
4446
InitInvok.setTargetTriple (options::Triple);
4445
4447
if (!options::SwiftVersion.empty ()) {
0 commit comments