@@ -1198,11 +1198,9 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
1198
1198
A->getAsString (Args), A->getValue ());
1199
1199
}
1200
1200
}
1201
-
1202
- // Autolink runtime compatibility libraries, if asked to.
1203
- if (!Args.hasArg (options::OPT_disable_autolinking_runtime_compatibility)) {
1201
+
1202
+ auto getRuntimeCompatVersion = [&] () -> Optional<llvm::VersionTuple> {
1204
1203
Optional<llvm::VersionTuple> runtimeCompatibilityVersion;
1205
-
1206
1204
if (auto versionArg = Args.getLastArg (
1207
1205
options::OPT_runtime_compatibility_version)) {
1208
1206
auto version = StringRef (versionArg->getValue ());
@@ -1218,15 +1216,18 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
1218
1216
runtimeCompatibilityVersion =
1219
1217
getSwiftRuntimeCompatibilityVersionForTarget (Triple);
1220
1218
}
1221
-
1222
- Opts.AutolinkRuntimeCompatibilityLibraryVersion =
1223
- runtimeCompatibilityVersion;
1219
+ return runtimeCompatibilityVersion;
1220
+ };
1221
+
1222
+ // Autolink runtime compatibility libraries, if asked to.
1223
+ if (!Args.hasArg (options::OPT_disable_autolinking_runtime_compatibility)) {
1224
+ Opts.AutolinkRuntimeCompatibilityLibraryVersion = getRuntimeCompatVersion ();
1224
1225
}
1225
1226
1226
1227
if (!Args.hasArg (options::
1227
1228
OPT_disable_autolinking_runtime_compatibility_dynamic_replacements)) {
1228
1229
Opts.AutolinkRuntimeCompatibilityDynamicReplacementLibraryVersion =
1229
- getSwiftRuntimeCompatibilityVersionForTarget (Triple );
1230
+ getRuntimeCompatVersion ( );
1230
1231
}
1231
1232
return false ;
1232
1233
}
0 commit comments