lib/ClangImporter/ImportDecl.cpp
/// Synthesize availability attributes for protocol requirements
/// based on availability of the types mentioned in the requirements.
Synthesize availability attributes for protocol requirements
based on availability of the types mentioned in the requirements.
Synthesize availability attributes for protocol requirements based on availability of the types mentioned in the requirements .
static void inferProtocolMemberAvailability(ClangImporter::Implementation &impl,
                                            DeclContext *dc, Decl *member) {
  if (member->getAttrs().hasAttribute<AvailableAttr>())
    return;
  auto *valueDecl = dyn_cast<ValueDecl>(member);
  if (!valueDecl)
    return;
  VersionRange requiredRange =
      AvailabilityInference::inferForType(valueDecl->getType());
  ASTContext &C = impl.SwiftContext;
  VersionRange containingDeclRange = AvailabilityInference::availableRange(
      dc->getInnermostDeclarationDeclContext(), C);
  requiredRange.constrainWith(containingDeclRange);
  applyAvailableAttribute(valueDecl, requiredRange, C);
}
static void inferProtocolMemberAvailability ( ClangImporter :: Implementation & impl , DeclContext * dc , Decl * member ) { if ( member -> getAttrs ( ) . hasAttribute < AvailableAttr > ( ) ) return ; auto * valueDecl = dyn_cast < ValueDecl > ( member ) ; if ( ! valueDecl ) return ; VersionRange requiredRange = AvailabilityInference :: inferForType ( valueDecl -> getType ( ) ) ; ASTContext & C = impl . SwiftContext ; VersionRange containingDeclRange = AvailabilityInference :: availableRange ( dc -> getInnermostDeclarationDeclContext ( ) , C ) ; requiredRange . constrainWith ( containingDeclRange ) ; applyAvailableAttribute ( valueDecl , requiredRange , C ) ; }
Synthesize availability attributes for protocol requirements
based on availability of the types mentioned in the requirements.
Synthesize availability attributes for protocol requirements based on availability of the types mentioned in the requirements .
// Don't synthesize attributes if there is already an // availability annotation.