AST/Sema: Resolve AvailabilityDomain in SemanticAvailableAttrRequest.

Look up the AvailabilityDomain given its name during type checking, instead of
parsing.
This commit is contained in:
Allan Shortlidge
2025-01-25 18:22:56 -08:00
parent 7b8cbd7109
commit a5d60ce35e
5 changed files with 42 additions and 2 deletions

View File

@@ -912,6 +912,12 @@ private:
private:
friend class SemanticAvailableAttrRequest;
void setCachedDomain(AvailabilityDomain domain) {
assert(!Bits.AvailableAttr.HasDomain);
Domain = domain;
Bits.AvailableAttr.HasDomain = true;
}
bool hasComputedSemanticAttr() const {
return Bits.AvailableAttr.HasComputedSemanticAttr;
}

View File

@@ -140,6 +140,10 @@ public:
return AvailabilityDomain(Kind::Embedded);
}
/// Returns the built-in availability domain identified by the given string.
static std::optional<AvailabilityDomain>
builtinDomainForString(StringRef string);
Kind getKind() const {
if (auto inlineDomain = getInlineDomain())
return inlineDomain->getKind();