Skip to content

Commit b4e2cff

Browse files
committed
AST: Introduce SemanticAvailableAttr::isSPI().
1 parent bc405c5 commit b4e2cff

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

include/swift/AST/Attr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3313,6 +3313,9 @@ class SemanticAvailableAttr final {
33133313
/// compilation context.
33143314
bool isActive(ASTContext &ctx) const;
33153315

3316+
/// Whether this attribute was spelled `@_spi_available`.
3317+
bool isSPI() const { return attr->isSPI(); }
3318+
33163319
bool operator==(const SemanticAvailableAttr &other) const {
33173320
return other.attr == attr;
33183321
}

lib/AST/Attr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ void DeclAttributes::dump(const Decl *D) const {
421421
LLVM_READONLY
422422
static bool isShortAvailable(const SemanticAvailableAttr &attr) {
423423
auto parsedAttr = attr.getParsedAttr();
424-
if (parsedAttr->isSPI())
424+
if (attr.isSPI())
425425
return false;
426426

427427
if (!attr.getIntroduced().has_value())

lib/AST/Availability.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void mergeWithInferredAvailability(SemanticAvailableAttr Attr,
156156
// The merge of two introduction versions is the maximum of the two versions.
157157
if (mergeIntoInferredVersion(Attr.getIntroduced(), Inferred.Introduced,
158158
std::max)) {
159-
Inferred.IsSPI = ParsedAttr->isSPI();
159+
Inferred.IsSPI = Attr.isSPI();
160160
}
161161

162162
// The merge of deprecated and obsoleted versions takes the minimum.
@@ -821,7 +821,7 @@ AvailabilityRange AvailabilityInference::availableRange(const Decl *D) {
821821

822822
bool AvailabilityInference::isAvailableAsSPI(const Decl *D) {
823823
if (auto attr = D->getAvailableAttrForPlatformIntroduction())
824-
return attr->getParsedAttr()->isSPI();
824+
return attr->isSPI();
825825

826826
return false;
827827
}

0 commit comments

Comments
 (0)