clang: lib/Sema/SemaAPINotes.cpp File Reference (original) (raw)
Go to the source code of this file.
Functions | |
---|---|
static bool | isIndirectPointerType (QualType Type) |
Determine whether this is a multi-level pointer type. | |
static void | applyNullability (Sema &S, Decl *D, NullabilityKind Nullability, VersionedInfoMetadata Metadata) |
Apply nullability to the given declaration. | |
static StringRef | ASTAllocateString (ASTContext &Ctx, StringRef String) |
Copy a string into ASTContext-allocated memory. | |
static AttributeCommonInfo | getPlaceholderAttrInfo () |
template | |
static void | handleAPINotedRetainCountAttribute (Sema &S, Decl *D, bool ShouldAddAttribute, VersionedInfoMetadata Metadata) |
static void | handleAPINotedRetainCountConvention (Sema &S, Decl *D, VersionedInfoMetadata Metadata, std::optional< api_notes::RetainCountConventionKind > Convention) |
static void | ProcessAPINotes (Sema &S, Decl *D, const api_notes::CommonEntityInfo &Info, VersionedInfoMetadata Metadata) |
static void | ProcessAPINotes (Sema &S, Decl *D, const api_notes::CommonTypeInfo &Info, VersionedInfoMetadata Metadata) |
static bool | checkAPINotesReplacementType (Sema &S, SourceLocation Loc, QualType OrigType, QualType ReplacementType) |
Check that the replacement type provided by API notes is reasonable. | |
static void | ProcessAPINotes (Sema &S, Decl *D, const api_notes::VariableInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a variable or property. | |
static void | ProcessAPINotes (Sema &S, ParmVarDecl *D, const api_notes::ParamInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a parameter. | |
static void | ProcessAPINotes (Sema &S, VarDecl *D, const api_notes::GlobalVariableInfo &Info, VersionedInfoMetadata metadata) |
Process API notes for a global variable. | |
static void | ProcessAPINotes (Sema &S, FieldDecl *D, const api_notes::FieldInfo &Info, VersionedInfoMetadata metadata) |
Process API notes for a C field. | |
static void | ProcessAPINotes (Sema &S, ObjCPropertyDecl *D, const api_notes::ObjCPropertyInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for an Objective-C property. | |
static void | ProcessAPINotes (Sema &S, FunctionOrMethod AnyFunc, const api_notes::FunctionInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a function or method. | |
static void | ProcessAPINotes (Sema &S, CXXMethodDecl *Method, const api_notes::CXXMethodInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a C++ method. | |
static void | ProcessAPINotes (Sema &S, FunctionDecl *D, const api_notes::GlobalFunctionInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a global function. | |
static void | ProcessAPINotes (Sema &S, EnumConstantDecl *D, const api_notes::EnumConstantInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for an enumerator. | |
static void | ProcessAPINotes (Sema &S, ObjCMethodDecl *D, const api_notes::ObjCMethodInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for an Objective-C method. | |
static void | ProcessAPINotes (Sema &S, TagDecl *D, const api_notes::TagInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a tag. | |
static void | ProcessAPINotes (Sema &S, TypedefNameDecl *D, const api_notes::TypedefInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for a typedef. | |
static void | ProcessAPINotes (Sema &S, ObjCContainerDecl *D, const api_notes::ContextInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for an Objective-C class or protocol. | |
static void | ProcessAPINotes (Sema &S, ObjCInterfaceDecl *D, const api_notes::ContextInfo &Info, VersionedInfoMetadata Metadata) |
Process API notes for an Objective-C class. | |
template | |
static void | maybeAttachUnversionedSwiftName (Sema &S, Decl *D, const api_notes::APINotesReader::VersionedInfo< SpecificInfo > Info) |
If we're applying API notes with an active, non-default version, and the versioned API notes have a SwiftName but the declaration normally wouldn't have one, add a removal attribute to make it clear that the new SwiftName attribute only applies to the active version of D, not to all versions. | |
template<typename SpecificDecl , typename SpecificInfo > | |
static void | ProcessVersionedAPINotes (Sema &S, SpecificDecl *D, const api_notes::APINotesReader::VersionedInfo< SpecificInfo > Info) |
Processes all versions of versioned API notes. | |
static std::optional< api_notes::Context > | UnwindNamespaceContext (DeclContext *DC, api_notes::APINotesManager &APINotes) |
static std::optional< api_notes::Context > | UnwindTagContext (TagDecl *DC, api_notes::APINotesManager &APINotes) |
◆ ATTR
Value:
template <> struct AttrKindFor<X##Attr> { \
static const attr::Kind value = attr::X; \
};
Attr - This represents one attribute.
Definition at line 133 of file SemaAPINotes.cpp.
◆ applyNullability()
static void applyNullability ( Sema & S, Decl * D, NullabilityKind Nullability, VersionedInfoMetadata Metadata ) | static |
---|
Apply nullability to the given declaration.
Definition at line 56 of file SemaAPINotes.cpp.
References clang::Sema::CheckImplicitNullabilityTypeSpecifier(), clang::Sema::Context, D, clang::Function, clang::FunctionType::getExtInfo(), clang::ASTContext::getFunctionNoProtoType(), clang::ASTContext::getFunctionType(), clang::Decl::getLocation(), clang::Value::getType(), isIndirectPointerType(), clang::ObjCPropertyAttribute::kind_null_resettable, clang::Decl::OBJC_TQ_CSNullability, and clang::Property.
Referenced by ProcessAPINotes().
◆ ASTAllocateString()
static StringRef ASTAllocateString ( ASTContext & Ctx, StringRef String ) | static |
---|
◆ checkAPINotesReplacementType()
◆ getPlaceholderAttrInfo()
◆ handleAPINotedRetainCountAttribute()
template
static void handleAPINotedRetainCountAttribute ( Sema & S, Decl * D, bool ShouldAddAttribute, VersionedInfoMetadata Metadata ) | static |
---|
◆ handleAPINotedRetainCountConvention()
◆ isIndirectPointerType()
◆ maybeAttachUnversionedSwiftName()
template
◆ ProcessAPINotes() [1/16]
Process API notes for a C++ method.
Definition at line 574 of file SemaAPINotes.cpp.
References clang::ast_matchers::attr, clang::Sema::Context, clang::ASTContext::getAttributedType(), getPlaceholderAttrInfo(), clang::ValueDecl::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::TypeLocBuilder::getTypeSourceInfo(), clang::sema::implicitObjectParamIsLifetimeBound(), ProcessAPINotes(), clang::TypeLocBuilder::push(), clang::TypeLocBuilder::pushFullCopy(), clang::AttributedTypeLoc::setAttr(), clang::ValueDecl::setType(), clang::DeclaratorDecl::setTypeSourceInfo(), and clang::api_notes::CXXMethodInfo::This.
◆ ProcessAPINotes() [2/16]
Definition at line 253 of file SemaAPINotes.cpp.
References clang::Sema::AP_Explicit, ASTAllocateString(), clang::Decl::attrs(), clang::C, clang::Sema::Context, D, clang::SemaSwift::DiagnoseName(), clang::IdentifierTable::get(), clang::Sema::getASTContext(), clang::Decl::getLocation(), getPlaceholderAttrInfo(), clang::ASTContext::Idents, clang::api_notes::CommonEntityInfo::isSwiftPrivate(), clang::Sema::Swift(), clang::api_notes::CommonEntityInfo::SwiftName, clang::api_notes::CommonEntityInfo::Unavailable, clang::api_notes::CommonEntityInfo::UnavailableInSwift, and clang::api_notes::CommonEntityInfo::UnavailableMsg.
Referenced by ProcessAPINotes(), and ProcessVersionedAPINotes().
◆ ProcessAPINotes() [3/16]
◆ ProcessAPINotes() [4/16]
Process API notes for a variable or property.
Definition at line 366 of file SemaAPINotes.cpp.
References clang::SemaObjC::AdjustParameterTypeForObjCAutoRefCount(), applyNullability(), checkAPINotesReplacementType(), clang::Sema::Context, D, clang::OpaquePtr< PtrTy >::get(), clang::ASTContext::getAdjustedParameterType(), clang::Decl::getLocation(), clang::api_notes::VariableInfo::getNullability(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::api_notes::VariableInfo::getType(), clang::Sema::GetTypeFromParser(), clang::Sema::ObjC(), clang::Sema::ParseTypeFromStringCallback, ProcessAPINotes(), and clang::Property.
◆ ProcessAPINotes() [5/16]
◆ ProcessAPINotes() [6/16]
◆ ProcessAPINotes() [7/16]
◆ ProcessAPINotes() [8/16]
static void ProcessAPINotes ( Sema & S, FunctionOrMethod AnyFunc, const api_notes::FunctionInfo & Info, VersionedInfoMetadata Metadata ) | static |
---|
Process API notes for a function or method.
Definition at line 477 of file SemaAPINotes.cpp.
References clang::Decl::addAttr(), applyNullability(), clang::Type::castAs(), checkAPINotesReplacementType(), clang::Sema::Context, D, clang::OpaquePtr< PtrTy >::get(), clang::Type::getAs(), clang::QualType::getAsOpaquePtr(), clang::ASTContext::getFunctionNoProtoType(), clang::ASTContext::getFunctionType(), clang::Decl::getLocation(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::api_notes::FunctionInfo::getParamTypeInfo(), clang::api_notes::FunctionInfo::getRetainCountConvention(), clang::FunctionDecl::getReturnType(), clang::ObjCMethodDecl::getReturnType(), clang::api_notes::FunctionInfo::getReturnTypeInfo(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::ValueDecl::getType(), clang::Sema::GetTypeFromParser(), handleAPINotedRetainCountConvention(), clang::QualType::isNull(), clang::api_notes::FunctionInfo::NullabilityAudited, clang::ObjCMethodDecl::param_begin(), clang::ObjCMethodDecl::param_size(), clang::FunctionDecl::parameters(), clang::api_notes::FunctionInfo::Params, clang::Sema::ParseTypeFromStringCallback, ProcessAPINotes(), clang::api_notes::FunctionInfo::ResultType, clang::ObjCMethodDecl::setReturnType(), clang::ObjCMethodDecl::setReturnTypeSourceInfo(), clang::ValueDecl::setType(), and clang::api_notes::FunctionInfo::SwiftReturnOwnership.
◆ ProcessAPINotes() [9/16]
◆ ProcessAPINotes() [10/16]
◆ ProcessAPINotes() [11/16]
◆ ProcessAPINotes() [12/16]
◆ ProcessAPINotes() [13/16]
◆ ProcessAPINotes() [14/16]
Process API notes for a tag.
Definition at line 635 of file SemaAPINotes.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, D, clang::api_notes::TagInfo::EnumExtensibility, getPlaceholderAttrInfo(), clang::api_notes::TagInfo::isFlagEnum(), clang::api_notes::TagInfo::isSwiftCopyable(), clang::api_notes::TagInfo::isSwiftEscapable(), ProcessAPINotes(), clang::api_notes::TagInfo::SwiftConformance, clang::api_notes::TagInfo::SwiftImportAs, clang::api_notes::TagInfo::SwiftReleaseOp, and clang::api_notes::TagInfo::SwiftRetainOp.
◆ ProcessAPINotes() [15/16]
◆ ProcessAPINotes() [16/16]
◆ ProcessVersionedAPINotes()
template<typename SpecificDecl , typename SpecificInfo >