mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Remove Decl::getSemanticUnavailableAttr().
Also remove the underlying `SemanticUnavailableAttrRequest`, which used memory very inefficiently in order to cache a detailed answer to what was usually a much simpler question. The only remaining use of `Decl::getSemanticUnavailableAttr()` that actually needed to locate the semantic attribute making a declaration unavailable was in `TypeCheckAttr.cpp`. The implementation of the request could just be used directly in that one location. The other remaining callers only needed to know if the decl was unavailable or not, which there are simpler queries for. # Please enter the commit message for your changes. Lines starting
This commit is contained in:
@@ -1442,19 +1442,6 @@ public:
|
||||
std::optional<std::pair<const AvailableAttr *, const Decl *>>
|
||||
getSemanticAvailableRangeAttr() const;
|
||||
|
||||
/// Retrieve the @available attribute that makes this declaration unavailable,
|
||||
/// if any. If \p ignoreAppExtensions is true then attributes for app
|
||||
/// extension platforms are ignored.
|
||||
///
|
||||
/// This attribute may come from an enclosing decl since availability is
|
||||
/// inherited. The second member of the returned pair is the decl that owns
|
||||
/// the attribute.
|
||||
///
|
||||
/// Note that this notion of unavailability is broader than that which is
|
||||
/// checked by \c isUnavailable().
|
||||
std::optional<std::pair<const AvailableAttr *, const Decl *>>
|
||||
getSemanticUnavailableAttr(bool ignoreAppExtensions = false) const;
|
||||
|
||||
/// Returns true if the decl is effectively always unavailable in the current
|
||||
/// compilation context. This query differs from \c isUnavailable() because it
|
||||
/// takes the availability of parent declarations into account.
|
||||
|
||||
@@ -4122,25 +4122,6 @@ public:
|
||||
bool isCached() const { return true; }
|
||||
};
|
||||
|
||||
class SemanticUnavailableAttrRequest
|
||||
: public SimpleRequest<SemanticUnavailableAttrRequest,
|
||||
std::optional<AvailableAttrDeclPair>(
|
||||
const Decl *decl, bool ignoreAppExtensions),
|
||||
RequestFlags::Cached> {
|
||||
public:
|
||||
using SimpleRequest::SimpleRequest;
|
||||
|
||||
private:
|
||||
friend SimpleRequest;
|
||||
|
||||
std::optional<AvailableAttrDeclPair>
|
||||
evaluate(Evaluator &evaluator, const Decl *decl,
|
||||
bool ignoreAppExtensions) const;
|
||||
|
||||
public:
|
||||
bool isCached() const { return true; }
|
||||
};
|
||||
|
||||
enum class SemanticDeclAvailability : uint8_t {
|
||||
/// The decl is potentially available in some contexts and/or under certain
|
||||
/// deployment conditions.
|
||||
|
||||
@@ -472,9 +472,6 @@ SWIFT_REQUEST(TypeChecker, RenamedDeclRequest,
|
||||
SWIFT_REQUEST(TypeChecker, SemanticAvailableRangeAttrRequest,
|
||||
Optional<AvailableAttrDeclPair>(const Decl *),
|
||||
Cached, NoLocationInfo)
|
||||
SWIFT_REQUEST(TypeChecker, SemanticUnavailableAttrRequest,
|
||||
Optional<AvailableAttrDeclPair>(const Decl *),
|
||||
Cached, NoLocationInfo)
|
||||
SWIFT_REQUEST(TypeChecker, SemanticDeclAvailabilityRequest,
|
||||
SemanticDeclAvailability(const Decl *),
|
||||
Cached, NoLocationInfo)
|
||||
|
||||
Reference in New Issue
Block a user