#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/Sema.h"
#include "clang/Sema/SemaObjC.h"
#include "llvm/ADT/StringRef.h"
#include <optional>
usingnamespaceclang;
usingnamespacesema;
static bool hasMatchingEnvironmentOrNone(const ASTContext &Context,
const AvailabilityAttr *AA) { … }
static const AvailabilityAttr *getAttrForPlatform(ASTContext &Context,
const Decl *D) { … }
static std::pair<AvailabilityResult, const NamedDecl *>
ShouldDiagnoseAvailabilityOfDecl(Sema &S, const NamedDecl *D,
std::string *Message,
ObjCInterfaceDecl *ClassReceiver) { … }
static bool ShouldDiagnoseAvailabilityInContext(
Sema &S, AvailabilityResult K, VersionTuple DeclVersion,
const IdentifierInfo *DeclEnv, Decl *Ctx, const NamedDecl *OffendingDecl) { … }
static unsigned getAvailabilityDiagnosticKind(
const ASTContext &Context, const VersionTuple &DeploymentVersion,
const VersionTuple &DeclVersion, bool HasMatchingEnv) { … }
static NamedDecl *findEnclosingDeclToAnnotate(Decl *OrigCtx) { … }
namespace {
struct AttributeInsertion { … };
}
static std::optional<unsigned>
tryParseObjCMethodName(StringRef Name, SmallVectorImpl<StringRef> &SlotNames,
const LangOptions &LangOpts) { … }
static std::optional<AttributeInsertion>
createAttributeInsertion(const NamedDecl *D, const SourceManager &SM,
const LangOptions &LangOpts) { … }
static void DoEmitAvailabilityWarning(Sema &S, AvailabilityResult K,
Decl *Ctx, const NamedDecl *ReferringDecl,
const NamedDecl *OffendingDecl,
StringRef Message,
ArrayRef<SourceLocation> Locs,
const ObjCInterfaceDecl *UnknownObjCClass,
const ObjCPropertyDecl *ObjCProperty,
bool ObjCPropertyAccess) { … }
void Sema::handleDelayedAvailabilityCheck(DelayedDiagnostic &DD, Decl *Ctx) { … }
static void EmitAvailabilityWarning(Sema &S, AvailabilityResult AR,
const NamedDecl *ReferringDecl,
const NamedDecl *OffendingDecl,
StringRef Message,
ArrayRef<SourceLocation> Locs,
const ObjCInterfaceDecl *UnknownObjCClass,
const ObjCPropertyDecl *ObjCProperty,
bool ObjCPropertyAccess) { … }
namespace {
bool isBodyLikeChildStmt(const Stmt *S, const Stmt *Parent) { … }
class StmtUSEFinder : public RecursiveASTVisitor<StmtUSEFinder> { … };
class LastDeclUSEFinder : public RecursiveASTVisitor<LastDeclUSEFinder> { … };
class DiagnoseUnguardedAvailability
: public RecursiveASTVisitor<DiagnoseUnguardedAvailability> { … };
void DiagnoseUnguardedAvailability::DiagnoseDeclAvailability(
NamedDecl *D, SourceRange Range, ObjCInterfaceDecl *ReceiverClass) { … }
bool DiagnoseUnguardedAvailability::VisitTypeLoc(TypeLoc Ty) { … }
bool DiagnoseUnguardedAvailability::TraverseIfStmt(IfStmt *If) { … }
}
void Sema::DiagnoseUnguardedAvailabilityViolations(Decl *D) { … }
FunctionScopeInfo *Sema::getCurFunctionAvailabilityContext() { … }
void Sema::DiagnoseAvailabilityOfDecl(NamedDecl *D,
ArrayRef<SourceLocation> Locs,
const ObjCInterfaceDecl *UnknownObjCClass,
bool ObjCPropertyAccess,
bool AvoidPartialAvailabilityChecks,
ObjCInterfaceDecl *ClassReceiver) { … }