Frontend: Replace the abi magic value accepted by -target-min-inlining-version with a min magic value instead. The new value corresponds to the OS versions in which Swift was introduced. The introduction OS is a better floor for availability checking than the OS in which Swift became ABI stable because inlinable functions may reference clang declarations which have availability between Swift's introduction and ABI stability and framework developers ought to get diagnostics for unguarded use of those APIs in inlinable code.

This commit is contained in:
Allan Shortlidge
2022-03-14 11:23:26 -07:00
parent f807ef92e6
commit b563dc0736
4 changed files with 64 additions and 27 deletions

View File

@@ -80,15 +80,20 @@ bool swift::triplesAreValidForZippering(const llvm::Triple &target,
}
const Optional<llvm::VersionTuple>
swift::minimumABIStableOSVersionForTriple(const llvm::Triple &triple) {
swift::minimumAvailableOSVersionForTriple(const llvm::Triple &triple) {
if (triple.isMacOSX())
return llvm::VersionTuple(10, 14, 4);
return llvm::VersionTuple(10, 10, 0);
if (triple.isiOS() /* including tvOS */)
return llvm::VersionTuple(12, 2);
// Note: this must come before checking iOS since that returns true for
// both iOS and tvOS.
if (triple.isTvOS())
return llvm::VersionTuple(9, 0);
if (triple.isiOS())
return llvm::VersionTuple(8, 0);
if (triple.isWatchOS())
return llvm::VersionTuple(5, 2);
return llvm::VersionTuple(2, 0);
return None;
}