Disable availability checking when type-checking the _Concurrency interface

Swift 5.5 didn't support back deployment of concurrency features, so a
Swift 5.5 compiler processing the _Concurrency .swiftinterface will
produce errors for each `async` function and actor with pre-macOS
12/iOS 15 availability. Emit `-disable-availability-checking` into the
generated `.swiftinterface` files to allow Swift 5.5 to continue to
build them.

Finishes rdar://82602353.
This commit is contained in:
Doug Gregor
2021-09-02 12:56:20 -07:00
parent 95d84d6581
commit a6c88ee52c

View File

@@ -370,6 +370,13 @@ static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts,
interleave(RenderedArgs,
[&](const char *Argument) { PrintArg(OS, Argument, StringRef()); },
[&] { OS << " "; });
// Backward-compatibility hack: disable availability checking in the
// _Concurrency module, so that older (Swift 5.5) compilers that did not
// support back deployment of concurrency do not complain about 'async'
// with older availability.
if (FOpts.ModuleName == "_Concurrency")
OS << " -disable-availability-checking";
}
{
llvm::raw_string_ostream OS(Opts.IgnorableFlags);