AST: Introduce Decl::getSemanticAvailableAttrs().

This new attribute iterator returned from the query makes it simpler to
implement algorithms that need access to both the `AvailableAttr *` and its
corresponding `AvailabilityDomain`. This is also work towards making it
possible to return an optional `AvailabilityDomain` from
`Decl::getDomainForAvailableAttr()`.
This commit is contained in:
Allan Shortlidge
2024-12-11 17:26:06 -08:00
parent a3d9776284
commit 0288eaa3b7
13 changed files with 176 additions and 72 deletions

View File

@@ -451,7 +451,9 @@ class InheritedProtocolCollector {
cache.emplace();
while (D) {
for (auto *nextAttr : D->getAttrs().getAttributes<AvailableAttr>()) {
for (auto semanticAttr : D->getSemanticAvailableAttrs()) {
auto nextAttr = semanticAttr.getParsedAttr();
// FIXME: This is just approximating the effects of nested availability
// attributes for the same platform; formally they'd need to be merged.
bool alreadyHasMoreSpecificAttrForThisPlatform =