Introduce a suppressible feature for availability on associated types

This allows us to emit Swift interfaces that can be handled by older
Swift compilers.
This commit is contained in:
Doug Gregor
2024-02-29 10:09:08 -08:00
parent 0652bb7abe
commit d1ac903be4
4 changed files with 33 additions and 3 deletions

View File

@@ -3305,6 +3305,20 @@ static bool usesFeatureNoAsyncAvailability(Decl *decl) {
return decl->getAttrs().getNoAsync(decl->getASTContext()) != nullptr;
}
static bool usesFeatureAssociatedTypeAvailability(Decl *decl) {
return isa<AssociatedTypeDecl>(decl) &&
decl->getAttrs().hasAttribute<AvailableAttr>();
}
static void
suppressingFeatureAssociatedTypeAvailability(
PrintOptions &options, llvm::function_ref<void()> action) {
unsigned originalExcludeAttrCount = options.ExcludeAttrList.size();
options.ExcludeAttrList.push_back(DeclAttrKind::Available);
action();
options.ExcludeAttrList.resize(originalExcludeAttrCount);
}
static bool usesFeatureBuiltinIntLiteralAccessors(Decl *decl) {
return false;
}