22struct AvailabilitySet {
23 bool UnconditionallyDeprecated =
false;
24 bool UnconditionallyUnavailable =
false;
27 auto *
Found = getForPlatform(Availability.Domain);
29 Found->mergeWith(std::move(Availability));
31 Availabilities.emplace_back(std::move(Availability));
35 auto *It = llvm::find_if(Availabilities,
39 return It == Availabilities.end() ? nullptr : It;
46static void createInfoForDecl(
const clang::Decl *Decl,
47 AvailabilitySet &Availabilities) {
49 for (
const auto *RD :
Decl->redecls()) {
50 for (
const auto *A : RD->specific_attrs<clang::AvailabilityAttr>()) {
52 A->getPlatform()->getName(), A->getIntroduced(), A->getDeprecated(),
53 A->getObsoleted(), A->getUnavailable(),
false,
false));
56 if (
const auto *A = RD->getAttr<clang::UnavailableAttr>())
58 Availabilities.UnconditionallyUnavailable =
true;
60 if (
const auto *A = RD->getAttr<clang::DeprecatedAttr>())
62 Availabilities.UnconditionallyDeprecated =
true;
98 AvailabilitySet Availabilities;
101 for (
const auto *Ctx =
D; Ctx;
102 Ctx = llvm::cast_or_null<Decl>(Ctx->getDeclContext()))
103 createInfoForDecl(Ctx, Availabilities);
105 if (
auto *Avail = Availabilities.getForPlatform(
106 D->getASTContext().getTargetInfo().getPlatformName())) {
107 Avail->UnconditionallyDeprecated = Availabilities.UnconditionallyDeprecated;
108 Avail->UnconditionallyUnavailable =
109 Availabilities.UnconditionallyUnavailable;
110 return std::move(*Avail);
Defines the clang::ASTContext interface.
Decl - This represents one declaration (or definition), e.g.
Defines the clang::TargetInfo interface.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.
Storage of availability attributes for a declaration.
llvm::SmallString< 32 > Domain
The domain is the platform for which this availability info applies to.
bool isDefault() const
Determine if this AvailabilityInfo represents the default availability.
void mergeWith(AvailabilityInfo Other)
Augments the existing information with additional constraints provided by Other.
bool UnconditionallyDeprecated
static AvailabilityInfo createFromDecl(const Decl *Decl)
bool UnconditionallyUnavailable