@@ -39,7 +39,7 @@ getCustomDomainKind(clang::FeatureAvailKind featureAvailKind) {
39
39
}
40
40
41
41
static const CustomAvailabilityDomain *
42
- customDomainForClangDecl (ValueDecl *decl, const ASTContext &ctx ) {
42
+ customDomainForClangDecl (ValueDecl *decl) {
43
43
auto *clangDecl = decl->getClangDecl ();
44
44
ASSERT (clangDecl);
45
45
@@ -57,6 +57,7 @@ customDomainForClangDecl(ValueDecl *decl, const ASTContext &ctx) {
57
57
if (featureInfo.second .Kind == clang::FeatureAvailKind::None)
58
58
return nullptr ;
59
59
60
+ auto &ctx = decl->getASTContext ();
60
61
FuncDecl *predicate = nullptr ;
61
62
if (featureInfo.second .Kind == clang::FeatureAvailKind::Dynamic)
62
63
predicate =
@@ -68,12 +69,13 @@ customDomainForClangDecl(ValueDecl *decl, const ASTContext &ctx) {
68
69
}
69
70
70
71
std::optional<AvailabilityDomain>
71
- AvailabilityDomain::forCustom (ValueDecl *decl, const ASTContext &ctx) {
72
+ AvailabilityDomainForDeclRequest::evaluate (Evaluator &evaluator,
73
+ ValueDecl *decl) const {
72
74
if (!decl)
73
75
return std::nullopt ;
74
76
75
77
if (decl->hasClangNode ()) {
76
- if (auto *customDomain = customDomainForClangDecl (decl, ctx ))
78
+ if (auto *customDomain = customDomainForClangDecl (decl))
77
79
return AvailabilityDomain::forCustom (customDomain);
78
80
} else {
79
81
// FIXME: [availability] Handle Swift availability domains decls.
@@ -82,6 +84,15 @@ AvailabilityDomain::forCustom(ValueDecl *decl, const ASTContext &ctx) {
82
84
return std::nullopt ;
83
85
}
84
86
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
+
85
96
std::optional<AvailabilityDomain>
86
97
AvailabilityDomain::builtinDomainForString (StringRef string,
87
98
const DeclContext *declContext) {
0 commit comments