Skip to content

Commit 670bfc0

Browse files
committed
AST: Remove unused ignoreAppExtensions parameter.
It's no longer used after the rewrite of the algorithm for determining if a declaration is unreachable at runtime.
1 parent 16de339 commit 670bfc0

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

include/swift/AST/Decl.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,8 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl>, public Swi
14321432
/// Returns the active platform-specific `@available` attribute for this decl.
14331433
/// There may be multiple `@available` attributes that are relevant to the
14341434
/// current platform, but the returned one has the highest priority.
1435-
std::optional<SemanticAvailableAttr> getActiveAvailableAttrForCurrentPlatform(
1436-
bool ignoreAppExtensions = false) const;
1435+
std::optional<SemanticAvailableAttr>
1436+
getActiveAvailableAttrForCurrentPlatform() const;
14371437

14381438
/// Returns the active platform-specific `@available` attribute that should be
14391439
/// used to determine the platform introduction version of the decl.
@@ -1479,8 +1479,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl>, public Swi
14791479
/// If the decl is always unavailable in the current compilation
14801480
/// context, returns the attribute attached to the decl (or its parent
14811481
/// extension) that makes it unavailable.
1482-
std::optional<SemanticAvailableAttr>
1483-
getUnavailableAttr(bool ignoreAppExtensions = false) const;
1482+
std::optional<SemanticAvailableAttr> getUnavailableAttr() const;
14841483

14851484
/// Returns true if the decl is effectively always unavailable in the current
14861485
/// compilation context. This query differs from \c isUnavailable() because it

lib/AST/Availability.cpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -456,17 +456,13 @@ Decl::getSemanticAvailableAttr(const AvailableAttr *attr) const {
456456
}
457457

458458
std::optional<SemanticAvailableAttr>
459-
Decl::getActiveAvailableAttrForCurrentPlatform(bool ignoreAppExtensions) const {
459+
Decl::getActiveAvailableAttrForCurrentPlatform() const {
460460
std::optional<SemanticAvailableAttr> bestAttr;
461461

462462
for (auto attr : getSemanticAvailableAttrs(/*includingInactive=*/false)) {
463463
if (!attr.isPlatformSpecific())
464464
continue;
465465

466-
if (ignoreAppExtensions &&
467-
isApplicationExtensionPlatform(attr.getPlatform()))
468-
continue;
469-
470466
// We have an attribute that is active for the platform, but is it more
471467
// specific than our current best?
472468
if (!bestAttr || inheritsAvailabilityFromPlatform(
@@ -577,23 +573,17 @@ bool Decl::isUnavailableInCurrentSwiftVersion() const {
577573
return false;
578574
}
579575

580-
std::optional<SemanticAvailableAttr>
581-
getDeclUnavailableAttr(const Decl *D, bool ignoreAppExtensions) {
576+
std::optional<SemanticAvailableAttr> getDeclUnavailableAttr(const Decl *D) {
582577
auto &ctx = D->getASTContext();
583578
std::optional<SemanticAvailableAttr> result;
584-
auto bestActive =
585-
D->getActiveAvailableAttrForCurrentPlatform(ignoreAppExtensions);
579+
auto bestActive = D->getActiveAvailableAttrForCurrentPlatform();
586580

587581
for (auto attr : D->getSemanticAvailableAttrs(/*includingInactive=*/false)) {
588582
// If this is a platform-specific attribute and it isn't the most
589583
// specific attribute for the current platform, we're done.
590584
if (attr.isPlatformSpecific() && (!bestActive || attr != bestActive))
591585
continue;
592586

593-
if (ignoreAppExtensions &&
594-
isApplicationExtensionPlatform(attr.getPlatform()))
595-
continue;
596-
597587
// Unconditional unavailable.
598588
if (attr.isUnconditionallyUnavailable())
599589
return attr;
@@ -612,9 +602,8 @@ getDeclUnavailableAttr(const Decl *D, bool ignoreAppExtensions) {
612602
return result;
613603
}
614604

615-
std::optional<SemanticAvailableAttr>
616-
Decl::getUnavailableAttr(bool ignoreAppExtensions) const {
617-
if (auto attr = getDeclUnavailableAttr(this, ignoreAppExtensions))
605+
std::optional<SemanticAvailableAttr> Decl::getUnavailableAttr() const {
606+
if (auto attr = getDeclUnavailableAttr(this))
618607
return attr;
619608

620609
// If D is an extension member, check if the extension is unavailable.
@@ -626,7 +615,7 @@ Decl::getUnavailableAttr(bool ignoreAppExtensions) const {
626615
// and the availability of other categories. rdar://problem/53956555
627616
if (!getClangNode())
628617
if (auto ext = dyn_cast<ExtensionDecl>(getDeclContext()))
629-
return ext->getUnavailableAttr(ignoreAppExtensions);
618+
return ext->getUnavailableAttr();
630619

631620
return std::nullopt;
632621
}

0 commit comments

Comments
 (0)