@@ -39,7 +39,7 @@ getCustomDomainKind(clang::FeatureAvailKind featureAvailKind) {
3939}
4040
4141static const CustomAvailabilityDomain *
42- customDomainForClangDecl (ValueDecl *decl, const ASTContext &ctx ) {
42+ customDomainForClangDecl (ValueDecl *decl) {
4343 auto *clangDecl = decl->getClangDecl ();
4444 ASSERT (clangDecl);
4545
@@ -57,6 +57,7 @@ customDomainForClangDecl(ValueDecl *decl, const ASTContext &ctx) {
5757 if (featureInfo.second .Kind == clang::FeatureAvailKind::None)
5858 return nullptr ;
5959
60+ auto &ctx = decl->getASTContext ();
6061 FuncDecl *predicate = nullptr ;
6162 if (featureInfo.second .Kind == clang::FeatureAvailKind::Dynamic)
6263 predicate =
@@ -68,12 +69,13 @@ customDomainForClangDecl(ValueDecl *decl, const ASTContext &ctx) {
6869}
6970
7071std::optional<AvailabilityDomain>
71- AvailabilityDomain::forCustom (ValueDecl *decl, const ASTContext &ctx) {
72+ AvailabilityDomainForDeclRequest::evaluate (Evaluator &evaluator,
73+ ValueDecl *decl) const {
7274 if (!decl)
7375 return std::nullopt ;
7476
7577 if (decl->hasClangNode ()) {
76- if (auto *customDomain = customDomainForClangDecl (decl, ctx ))
78+ if (auto *customDomain = customDomainForClangDecl (decl))
7779 return AvailabilityDomain::forCustom (customDomain);
7880 } else {
7981 // FIXME: [availability] Handle Swift availability domains decls.
@@ -82,6 +84,15 @@ AvailabilityDomain::forCustom(ValueDecl *decl, const ASTContext &ctx) {
8284 return std::nullopt ;
8385}
8486
87+ std::optional<AvailabilityDomain>
88+ AvailabilityDomain::forCustom (ValueDecl *decl) {
89+ if (!decl)
90+ return std::nullopt ;
91+
92+ return evaluateOrDefault (decl->getASTContext ().evaluator ,
93+ AvailabilityDomainForDeclRequest{decl}, {});
94+ }
95+
8596std::optional<AvailabilityDomain>
8697AvailabilityDomain::builtinDomainForString (StringRef string,
8798 const DeclContext *declContext) {
0 commit comments