Merge pull request #41940 from tshortli/target-min-inlining-version-min-by-default

Assume `-target-min-inlining-version min` for `-library-level api` modules
This commit is contained in:
Allan Shortlidge
2022-03-22 15:26:02 -07:00
committed by GitHub
2 changed files with 22 additions and 12 deletions

View File

@@ -804,17 +804,15 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
// First, set up default minimum inlining target versions.
auto getDefaultMinimumInliningTargetVersion =
[&](const llvm::Triple &triple) -> llvm::VersionTuple {
#if SWIFT_DEFAULT_TARGET_MIN_INLINING_VERSION_TO_MIN
// In ABI-stable modules, default to the version when Swift first became
// available.
if (FrontendOpts.EnableLibraryEvolution)
// In API modules, default to the version when Swift first became available.
if (Opts.LibraryLevel == LibraryLevel::API)
if (auto minTriple = minimumAvailableOSVersionForTriple(triple))
return minTriple;
#endif
return *minTriple;
// In ABI-unstable modules, we will never have to interoperate with
// older versions of the module, so we should default to the minimum
// deployment target.
// In other modules, assume that availability is used less consistently
// and that library clients will generally raise deployment targets as the
// library evolves so the min inlining version should be the deployment
// target by default.
unsigned major, minor, patch;
if (triple.isMacOSX())
triple.getMacOSXVersion(major, minor, patch);