Merge pull request #72321 from xymus/spi-only-swift-6

Frontend: Allow use of `@_spiOnly` by default in Swift 6
This commit is contained in:
Alexis Laferrière
2024-03-14 16:05:53 -07:00
committed by GitHub
5 changed files with 27 additions and 1 deletions

View File

@@ -3341,6 +3341,17 @@ bool CompilerInvocation::parseArgs(
}
}
// With Swift 6, enable @_spiOnly by default and forbid the old version.
// This also enables proper error reporting of ioi references from spi decls.
if (LangOpts.EffectiveLanguageVersion.isVersionAtLeast(6)) {
LangOpts.EnableSPIOnlyImports = true;
if (ParsedArgs.hasArg(OPT_experimental_spi_imports)) {
Diags.diagnose(SourceLoc(), diag::error_old_spi_only_import_unsupported);
return true;
}
}
return false;
}