|
clang 22.0.0git
|
#include "clang/AST/Attr.h"#include "clang/AST/Decl.h"#include "clang/AST/DeclTemplate.h"#include "clang/AST/DynamicRecursiveASTVisitor.h"#include "clang/AST/ExprObjC.h"#include "clang/AST/StmtObjC.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>Go to the source code of this file.
Functions | |
| static bool | hasMatchingEnvironmentOrNone (const ASTContext &Context, const AvailabilityAttr *AA) |
| static const AvailabilityAttr * | getAttrForPlatform (ASTContext &Context, const Decl *D) |
| static bool | ShouldDiagnoseAvailabilityInContext (Sema &S, AvailabilityResult K, VersionTuple DeclVersion, const IdentifierInfo *DeclEnv, Decl *Ctx, const NamedDecl *OffendingDecl) |
whether we should emit a diagnostic for K and DeclVersion in the context of Ctx. | |
| static unsigned | getAvailabilityDiagnosticKind (const ASTContext &Context, const VersionTuple &DeploymentVersion, const VersionTuple &DeclVersion, bool HasMatchingEnv) |
| static NamedDecl * | findEnclosingDeclToAnnotate (Decl *OrigCtx) |
| static std::optional< unsigned > | tryParseObjCMethodName (StringRef Name, SmallVectorImpl< StringRef > &SlotNames, const LangOptions &LangOpts) |
| Tries to parse a string as ObjC method name. | |
| static std::optional< AttributeInsertion > | createAttributeInsertion (const NamedDecl *D, const SourceManager &SM, const LangOptions &LangOpts) |
| Returns a source location in which it's appropriate to insert a new attribute for the given declaration \D. | |
| 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) |
| Actually emit an availability diagnostic for a reference to an unavailable decl. | |
| 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) |
|
static |
Returns a source location in which it's appropriate to insert a new attribute for the given declaration \D.
Definition at line 379 of file SemaAvailability.cpp.
References clang::Lexer::getLocForEndOfToken(), clang::isa(), clang::SourceLocation::isInvalid(), and SM.
Referenced by DoEmitAvailabilityWarning().
|
static |
Actually emit an availability diagnostic for a reference to an unavailable decl.
| Ctx | The context that the reference occurred in |
| ReferringDecl | The exact declaration that was referenced. |
| OffendingDecl | A related decl to ReferringDecl that has an availability attribute corresponding to K attached to it. Note that this may not be the same as ReferringDecl, i.e. if an EnumDecl is annotated and we refer to a member EnumConstantDecl, ReferringDecl is the EnumConstantDecl and OffendingDecl is the EnumDecl. |
Definition at line 409 of file SemaAvailability.cpp.
References clang::AR_Available, clang::AR_Deprecated, clang::AR_NotYetIntroduced, clang::AR_Unavailable, clang::Sema::Context, createAttributeInsertion(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateReplacement(), clang::Sema::currentEvaluationContext(), clang::SemaBase::Diag(), findEnclosingDeclToAnnotate(), clang::Sema::getASTContext(), clang::Decl::getAttr(), getAttrForPlatform(), getAvailabilityDiagnosticKind(), clang::CharSourceRange::getCharRange(), clang::Sema::getCurFunctionDecl(), clang::NamedDecl::getDeclName(), clang::Sema::getDiagnostics(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getLocForEndOfToken(), clang::NamedDecl::getMostRecentDecl(), clang::Selector::getNameForSlot(), clang::Selector::getNumArgs(), clang::TargetInfo::getPlatformMinVersion(), clang::TargetInfo::getPlatformName(), clang::Sema::getPreprocessor(), clang::Decl::getPreviousDecl(), clang::Sema::getSourceManager(), clang::DiagnosticsEngine::getSuppressSystemWarnings(), clang::ASTContext::getTargetInfo(), clang::Sema::getTopMostPointOfInstantiation(), clang::TargetInfo::getTriple(), clang::Decl::getVersionIntroduced(), hasMatchingEnvironmentOrNone(), clang::Sema::ExpressionEvaluationContextRecord::IsCaseExpr, clang::SourceManager::isInSystemHeader(), clang::Preprocessor::isMacroDefined(), clang::CharSourceRange::isValid(), clang::DiagnosticsEngine::setSuppressSystemWarnings(), ShouldDiagnoseAvailabilityInContext(), and tryParseObjCMethodName().
Referenced by EmitAvailabilityWarning(), and clang::Sema::handleDelayedAvailabilityCheck().
|
static |
Definition at line 721 of file SemaAvailability.cpp.
References clang::Sema::DelayedDiagnostics::add(), clang::cast(), clang::Sema::DelayedDiagnostics, DoEmitAvailabilityWarning(), clang::Sema::getCurLexicalContext(), clang::sema::DelayedDiagnostic::makeAvailability(), and clang::Sema::DelayedDiagnostics::shouldDelayDiagnostics().
Referenced by clang::Sema::DiagnoseAvailabilityOfDecl().
Definition at line 302 of file SemaAvailability.cpp.
References clang::cast(), and clang::isa().
Referenced by DoEmitAvailabilityWarning().
|
static |
Definition at line 46 of file SemaAvailability.cpp.
References clang::Decl::attrs(), and hasMatchingEnvironmentOrNone().
Referenced by DoEmitAvailabilityWarning(), and ShouldDiagnoseAvailabilityInContext().
|
static |
Definition at line 259 of file SemaAvailability.cpp.
Referenced by DoEmitAvailabilityWarning().
|
static |
Definition at line 34 of file SemaAvailability.cpp.
References clang::IdentifierInfo::getName().
Referenced by DoEmitAvailabilityWarning(), and getAttrForPlatform().
|
static |
whether we should emit a diagnostic for K and DeclVersion in the context of Ctx.
For example, we should emit an unavailable diagnostic in a deprecated context, but not the other way around.
Definition at line 167 of file SemaAvailability.cpp.
References clang::AR_Available, clang::AR_Deprecated, clang::AR_NotYetIntroduced, clang::AR_Unavailable, clang::C, clang::Sema::Context, clang::Sema::getASTContext(), getAttrForPlatform(), clang::Decl::getBeginLoc(), clang::Decl::getDeclContext(), clang::Preprocessor::getImmediateMacroName(), clang::Sema::getLangOpts(), clang::Sema::getPreprocessor(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::Interface, and clang::isa().
Referenced by DoEmitAvailabilityWarning().
|
static |
Tries to parse a string as ObjC method name.
| Name | The string to parse. Expected to originate from availability attribute argument. |
| SlotNames | The vector that will be populated with slot names. In case of unsuccessful parsing can contain invalid data. |
Definition at line 346 of file SemaAvailability.cpp.
References clang::isValidAsciiIdentifier().
Referenced by DoEmitAvailabilityWarning().