[AST][IRGen] Add -min-runtime-version option and IRGen support code.

Add a `-min-runtime-version` option that can be used to avoid problems
when building on Linux and Windows where because the runtime isn't
part of the OS, availability doesn't solve the problem of trying to
build the compiler against an older runtime.

Also add functions to IRGen to make it easy to test feature
availability using both the runtime version and the existing Darwin
availability support.

rdar://121522431
This commit is contained in:
Alastair Houghton
2024-02-02 16:17:08 +00:00
parent c2c4f87ccb
commit c226bf3c3c
9 changed files with 69 additions and 10 deletions

View File

@@ -1213,6 +1213,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
// FIXME: Should we diagnose if it's below the default?
Opts.MinimumInliningTargetVersion = *vers;
if (auto vers = parseVersionArg(OPT_min_runtime_version))
Opts.RuntimeVersion = version::Version(*vers);
if (auto vers = parseVersionArg(OPT_target_sdk_version))
Opts.SDKVersion = *vers;