#include "clang/APINotes/APINotesReader.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Lexer.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaSwift.h"
#include <stack>
usingnamespaceclang;
namespace {
enum class IsActive_t : bool { … };
enum class IsSubstitution_t : bool { … };
struct VersionedInfoMetadata { … };
}
static bool isIndirectPointerType(QualType Type) { … }
static void applyNullability(Sema &S, Decl *D, NullabilityKind Nullability,
VersionedInfoMetadata Metadata) { … }
static StringRef ASTAllocateString(ASTContext &Ctx, StringRef String) { … }
static AttributeCommonInfo getPlaceholderAttrInfo() { … }
namespace {
template <typename A> struct AttrKindFor { … };
#define ATTR …
#include "clang/Basic/AttrList.inc"
template <typename A>
void handleAPINotedAttribute(
Sema &S, Decl *D, bool IsAddition, VersionedInfoMetadata Metadata,
llvm::function_ref<A *()> CreateAttr,
llvm::function_ref<Decl::attr_iterator(const Decl *)> GetExistingAttr) { … }
template <typename A>
void handleAPINotedAttribute(Sema &S, Decl *D, bool ShouldAddAttribute,
VersionedInfoMetadata Metadata,
llvm::function_ref<A *()> CreateAttr) { … }
}
template <typename A>
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) { … }
static void ProcessAPINotes(Sema &S, Decl *D,
const api_notes::VariableInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, ParmVarDecl *D,
const api_notes::ParamInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, VarDecl *D,
const api_notes::GlobalVariableInfo &Info,
VersionedInfoMetadata metadata) { … }
static void ProcessAPINotes(Sema &S, FieldDecl *D,
const api_notes::FieldInfo &Info,
VersionedInfoMetadata metadata) { … }
static void ProcessAPINotes(Sema &S, ObjCPropertyDecl *D,
const api_notes::ObjCPropertyInfo &Info,
VersionedInfoMetadata Metadata) { … }
namespace {
FunctionOrMethod;
}
static void ProcessAPINotes(Sema &S, FunctionOrMethod AnyFunc,
const api_notes::FunctionInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, CXXMethodDecl *Method,
const api_notes::CXXMethodInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, FunctionDecl *D,
const api_notes::GlobalFunctionInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, EnumConstantDecl *D,
const api_notes::EnumConstantInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, ObjCMethodDecl *D,
const api_notes::ObjCMethodInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, TagDecl *D, const api_notes::TagInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, TypedefNameDecl *D,
const api_notes::TypedefInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, ObjCContainerDecl *D,
const api_notes::ContextInfo &Info,
VersionedInfoMetadata Metadata) { … }
static void ProcessAPINotes(Sema &S, ObjCInterfaceDecl *D,
const api_notes::ContextInfo &Info,
VersionedInfoMetadata Metadata) { … }
template <typename SpecificInfo>
static void maybeAttachUnversionedSwiftName(
Sema &S, Decl *D,
const api_notes::APINotesReader::VersionedInfo<SpecificInfo> Info) { … }
template <typename SpecificDecl, typename SpecificInfo>
static void ProcessVersionedAPINotes(
Sema &S, SpecificDecl *D,
const api_notes::APINotesReader::VersionedInfo<SpecificInfo> Info) { … }
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) { … }
void Sema::ProcessAPINotes(Decl *D) { … }