23enum class IsActive_t :
bool { Inactive, Active };
24enum class IsSubstitution_t :
bool { Original, Replacement };
26struct VersionedInfoMetadata {
29 unsigned IsActive : 1;
30 unsigned IsReplacement : 1;
32 VersionedInfoMetadata(VersionTuple Version, IsActive_t Active,
33 IsSubstitution_t Replacement)
34 : Version(Version), IsActive(Active == IsActive_t::Active),
35 IsReplacement(Replacement == IsSubstitution_t::Replacement) {}
51 VersionedInfoMetadata Metadata) {
52 if (!Metadata.IsActive)
62 return (QT.getTypePtr() != Original.getTypePtr()) ? std::optional(QT)
66 if (
auto Function = dyn_cast<FunctionDecl>(D)) {
68 GetModified(D,
Function->getReturnType(), Nullability)) {
72 *Modified, proto->getParamTypes(), proto->getExtProtoInfo()));
77 }
else if (
auto Method = dyn_cast<ObjCMethodDecl>(D)) {
78 if (
auto Modified = GetModified(D, Method->getReturnType(), Nullability)) {
79 Method->setReturnType(*Modified);
86 }
else if (
auto Value = dyn_cast<ValueDecl>(D)) {
87 if (
auto Modified = GetModified(D,
Value->
getType(), Nullability)) {
88 Value->setType(*Modified);
91 if (
auto Parm = dyn_cast<ParmVarDecl>(D)) {
97 }
else if (
auto Property = dyn_cast<ObjCPropertyDecl>(D)) {
98 if (
auto Modified = GetModified(D,
Property->getType(), Nullability)) {
111 void *mem = Ctx.
Allocate(String.size(),
alignof(
char *));
112 memcpy(mem, String.data(), String.size());
113 return StringRef(
static_cast<char *
>(mem), String.size());
125template <
typename A>
struct AttrKindFor {};
128 template <> struct AttrKindFor<X##Attr> { \
129 static const attr::Kind value = attr::X; \
131#include "clang/Basic/AttrList.inc"
139void handleAPINotedAttribute(
140 Sema &S,
Decl *D,
bool IsAddition, VersionedInfoMetadata Metadata,
141 llvm::function_ref<A *()> CreateAttr,
143 if (Metadata.IsActive) {
144 auto Existing = GetExistingAttr(D);
148 auto *Versioned = SwiftVersionedAdditionAttr::CreateImplicit(
149 S.
Context, Metadata.Version, *Existing,
true);
157 if (
auto Attr = CreateAttr())
164 if (
auto Attr = CreateAttr()) {
165 auto *Versioned = SwiftVersionedAdditionAttr::CreateImplicit(
167 Metadata.IsReplacement);
174 auto *Versioned = SwiftVersionedRemovalAttr::CreateImplicit(
175 S.
Context, Metadata.Version, AttrKindFor<A>::value,
176 Metadata.IsReplacement);
182void handleAPINotedAttribute(
Sema &S,
Decl *D,
bool ShouldAddAttribute,
183 VersionedInfoMetadata Metadata,
184 llvm::function_ref<A *()> CreateAttr) {
185 handleAPINotedAttribute<A>(
186 S, D, ShouldAddAttribute, Metadata, CreateAttr, [](
const Decl *D) {
187 return llvm::find_if(D->
attrs(),
188 [](
const Attr *Next) { return isa<A>(Next); });
195 bool ShouldAddAttribute,
196 VersionedInfoMetadata Metadata) {
199 handleAPINotedAttribute<A>(
200 S, D, ShouldAddAttribute, Metadata,
203 return llvm::find_if(D->
attrs(), [](
const Attr *Next) ->
bool {
204 return isa<CFReturnsRetainedAttr>(Next) ||
205 isa<CFReturnsNotRetainedAttr>(Next) ||
206 isa<NSReturnsRetainedAttr>(Next) ||
207 isa<NSReturnsNotRetainedAttr>(Next) ||
208 isa<CFAuditedTransferAttr>(Next);
214 Sema &S,
Decl *D, VersionedInfoMetadata Metadata,
215 std::optional<api_notes::RetainCountConventionKind> Convention) {
218 switch (*Convention) {
219 case api_notes::RetainCountConventionKind::None:
220 if (isa<FunctionDecl>(D)) {
221 handleAPINotedRetainCountAttribute<CFUnknownTransferAttr>(
222 S, D,
true, Metadata);
224 handleAPINotedRetainCountAttribute<CFReturnsRetainedAttr>(
225 S, D,
false, Metadata);
228 case api_notes::RetainCountConventionKind::CFReturnsRetained:
229 handleAPINotedRetainCountAttribute<CFReturnsRetainedAttr>(
230 S, D,
true, Metadata);
232 case api_notes::RetainCountConventionKind::CFReturnsNotRetained:
233 handleAPINotedRetainCountAttribute<CFReturnsNotRetainedAttr>(
234 S, D,
true, Metadata);
236 case api_notes::RetainCountConventionKind::NSReturnsRetained:
237 handleAPINotedRetainCountAttribute<NSReturnsRetainedAttr>(
238 S, D,
true, Metadata);
240 case api_notes::RetainCountConventionKind::NSReturnsNotRetained:
241 handleAPINotedRetainCountAttribute<NSReturnsNotRetainedAttr>(
242 S, D,
true, Metadata);
249 VersionedInfoMetadata Metadata) {
252 handleAPINotedAttribute<UnavailableAttr>(S, D,
true, Metadata, [&] {
260 handleAPINotedAttribute<AvailabilityAttr>(
261 S, D,
true, Metadata,
263 return new (S.
Context) AvailabilityAttr(
274 return llvm::find_if(D->
attrs(), [](
const Attr *next) ->
bool {
275 if (const auto *AA = dyn_cast<AvailabilityAttr>(next))
276 if (const auto *II = AA->getPlatform())
277 return II->isStr(
"swift");
285 handleAPINotedAttribute<SwiftPrivateAttr>(
286 S, D, *SwiftPrivate, Metadata, [&] {
294 handleAPINotedAttribute<SwiftNameAttr>(
295 S, D,
true, Metadata, [&]() -> SwiftNameAttr * {
300 AP.create(&
C.Idents.get(
"swift_name"),
SourceRange(),
nullptr,
302 ParsedAttr::Form::GNU());
317 VersionedInfoMetadata Metadata) {
320 handleAPINotedAttribute<SwiftBridgeAttr>(
321 S, D, !SwiftBridge->empty(), Metadata, [&] {
322 return new (S.Context)
323 SwiftBridgeAttr(S.Context, getPlaceholderAttrInfo(),
324 ASTAllocateString(S.Context, *SwiftBridge));
330 handleAPINotedAttribute<NSErrorDomainAttr>(
331 S, D, !NSErrorDomain->empty(), Metadata, [&] {
332 return new (S.Context)
333 NSErrorDomainAttr(S.Context, getPlaceholderAttrInfo(),
334 &S.Context.Idents.get(*NSErrorDomain));
350 S.
Diag(Loc, diag::err_incompatible_replacement_type)
351 << ReplacementType << OrigType;
361 VersionedInfoMetadata Metadata) {
363 if (Metadata.IsActive && !Info.
getType().empty() &&
372 if (
auto Var = dyn_cast<VarDecl>(D)) {
374 if (isa<ParmVarDecl>(Var)) {
385 }
else if (
auto Property = dyn_cast<ObjCPropertyDecl>(D)) {
391 llvm_unreachable(
"API notes allowed a type on an unknown declaration");
407 VersionedInfoMetadata Metadata) {
410 handleAPINotedAttribute<NoEscapeAttr>(S, D, *NoEscape, Metadata, [&] {
426 VersionedInfoMetadata metadata) {
435 VersionedInfoMetadata Metadata) {
441 handleAPINotedAttribute<SwiftImportPropertyAsAccessorsAttr>(
442 S, D, *AsAccessors, Metadata, [&] {
443 return new (S.
Context) SwiftImportPropertyAsAccessorsAttr(
450typedef llvm::PointerUnion<FunctionDecl *, ObjCMethodDecl *> FunctionOrMethod;
456 VersionedInfoMetadata Metadata) {
466 assert((FD || MD) &&
"Expecting Function or ObjCMethod");
475 bool AnyTypeChanged =
false;
476 for (
unsigned I = 0; I != NumParams; ++I) {
480 if (I < Info.
Params.size())
488 AnyTypeChanged =
true;
493 if (Metadata.IsActive && !Info.
ResultType.empty() &&
496 Info.
ResultType,
"<API Notes>", D->getLocation());
503 auto ResultTypeInfo =
510 OverriddenResultType = ResultType;
511 AnyTypeChanged =
true;
518 if (FD && AnyTypeChanged) {
520 if (OverriddenResultType.
isNull())
521 OverriddenResultType = fnProtoType->getReturnType();
525 ParamTypes.push_back(Param->getType());
528 fnProtoType->getExtProtoInfo()));
529 }
else if (!OverriddenResultType.
isNull()) {
532 OverriddenResultType, FnNoProtoType->getExtInfo()));
548 VersionedInfoMetadata Metadata) {
557 VersionedInfoMetadata Metadata) {
566 VersionedInfoMetadata Metadata) {
569 handleAPINotedAttribute<ObjCDesignatedInitializerAttr>(
570 S, D,
true, Metadata, [&] {
572 IFace->setHasDesignatedInitializers();
574 return new (S.
Context) ObjCDesignatedInitializerAttr(
586 VersionedInfoMetadata Metadata) {
588 D->
addAttr(SwiftAttrAttr::Create(S.
Context,
"import_" + ImportAs.value()));
591 D->
addAttr(SwiftAttrAttr::Create(S.
Context,
"retain:" + RetainOp.value()));
595 SwiftAttrAttr::Create(S.
Context,
"release:" + ReleaseOp.value()));
604 bool ShouldAddAttribute = (*Extensibility != EnumExtensibilityKind::None);
605 handleAPINotedAttribute<EnumExtensibilityAttr>(
606 S, D, ShouldAddAttribute, Metadata, [&] {
607 EnumExtensibilityAttr::Kind kind;
608 switch (*Extensibility) {
609 case EnumExtensibilityKind::None:
610 llvm_unreachable(
"remove only");
611 case EnumExtensibilityKind::Open:
612 kind = EnumExtensibilityAttr::Open;
614 case EnumExtensibilityKind::Closed:
615 kind = EnumExtensibilityAttr::Closed;
624 handleAPINotedAttribute<FlagEnumAttr>(S, D, *FlagEnum, Metadata, [&] {
637 VersionedInfoMetadata Metadata) {
642 handleAPINotedAttribute<SwiftNewTypeAttr>(
643 S, D, *SwiftWrapper != SwiftWrapperKind::None, Metadata, [&] {
644 SwiftNewTypeAttr::NewtypeKind Kind;
645 switch (*SwiftWrapper) {
646 case SwiftWrapperKind::None:
647 llvm_unreachable(
"Shouldn't build an attribute");
649 case SwiftWrapperKind::Struct:
650 Kind = SwiftNewTypeAttr::NK_Struct;
653 case SwiftWrapperKind::Enum:
654 Kind = SwiftNewTypeAttr::NK_Enum;
659 AttributeCommonInfo::AT_SwiftNewType,
662 return new (S.
Context) SwiftNewTypeAttr(S.
Context, SyntaxInfo, Kind);
674 VersionedInfoMetadata Metadata) {
683 VersionedInfoMetadata Metadata) {
685 handleAPINotedAttribute<SwiftImportAsNonGenericAttr>(
686 S, D, *AsNonGeneric, Metadata, [&] {
693 handleAPINotedAttribute<SwiftObjCMembersAttr>(
694 S, D, *ObjcMembers, Metadata, [&] {
713template <
typename SpecificInfo>
717 if (D->
hasAttr<SwiftNameAttr>())
723 VersionTuple SelectedVersion;
724 SpecificInfo SelectedInfoSlice;
725 std::tie(SelectedVersion, SelectedInfoSlice) = Info[*Info.
getSelected()];
726 if (SelectedVersion.empty())
728 if (SelectedInfoSlice.SwiftName.empty())
732 for (
const auto &VersionAndInfoSlice : Info) {
733 if (!VersionAndInfoSlice.first.empty())
735 if (!VersionAndInfoSlice.second.SwiftName.empty())
740 VersionedInfoMetadata DummyFutureMetadata(
741 SelectedVersion, IsActive_t::Inactive, IsSubstitution_t::Replacement);
742 handleAPINotedAttribute<SwiftNameAttr>(
743 S, D,
false, DummyFutureMetadata, []() -> SwiftNameAttr * {
744 llvm_unreachable(
"should not try to add an attribute here");
751template <
typename SpecificDecl,
typename SpecificInfo>
753 Sema &S, SpecificDecl *D,
760 VersionTuple Version;
761 SpecificInfo InfoSlice;
762 for (
unsigned i = 0, e = Info.
size(); i != e; ++i) {
763 std::tie(Version, InfoSlice) = Info[i];
764 auto Active = (i == Selected) ? IsActive_t::Active : IsActive_t::Inactive;
765 auto Replacement = IsSubstitution_t::Original;
766 if (Active == IsActive_t::Inactive && Version.empty()) {
767 Replacement = IsSubstitution_t::Replacement;
768 Version = Info[Selected].first;
771 VersionedInfoMetadata(Version, Active, Replacement));
786 std::optional<api_notes::Context> APINotesContext;
787 if (
auto NamespaceContext = dyn_cast<NamespaceDecl>(D->
getDeclContext())) {
791 std::stack<NamespaceDecl *> NamespaceStack;
793 for (
auto CurrentNamespace = NamespaceContext; CurrentNamespace;
795 dyn_cast<NamespaceDecl>(CurrentNamespace->getParent())) {
796 if (!CurrentNamespace->isInlineNamespace())
797 NamespaceStack.push(CurrentNamespace);
800 std::optional<api_notes::ContextID> NamespaceID;
801 while (!NamespaceStack.empty()) {
802 auto CurrentNamespace = NamespaceStack.top();
803 NamespaceStack.pop();
804 NamespaceID = Reader->lookupNamespaceID(CurrentNamespace->getName(),
816 if (
auto VD = dyn_cast<VarDecl>(D)) {
819 Reader->lookupGlobalVariable(VD->getName(), APINotesContext);
827 if (
auto FD = dyn_cast<FunctionDecl>(D)) {
828 if (FD->getDeclName().isIdentifier()) {
831 Reader->lookupGlobalFunction(FD->getName(), APINotesContext);
840 if (
auto Class = dyn_cast<ObjCInterfaceDecl>(D)) {
842 auto Info = Reader->lookupObjCClassInfo(
Class->getName());
850 if (
auto Protocol = dyn_cast<ObjCProtocolDecl>(D)) {
852 auto Info = Reader->lookupObjCProtocolInfo(Protocol->getName());
860 if (
auto Tag = dyn_cast<TagDecl>(D)) {
861 std::string
LookupName = Tag->getName().str();
868 std::string MacroName =
869 LookupName.empty() && Tag->getOuterLocStart().isMacroID()
871 Tag->getOuterLocStart(),
872 Tag->getASTContext().getSourceManager(),
LangOpts)
876 if (
LookupName.empty() && isa<clang::EnumDecl>(Tag) &&
877 (MacroName ==
"CF_OPTIONS" || MacroName ==
"NS_OPTIONS" ||
878 MacroName ==
"OBJC_OPTIONS" || MacroName ==
"SWIFT_OPTIONS")) {
886 auto Info = Reader->lookupTag(
LookupName, APINotesContext);
894 if (
auto Typedef = dyn_cast<TypedefNameDecl>(D)) {
896 auto Info = Reader->lookupTypedef(Typedef->getName(), APINotesContext);
907 if (
auto EnumConstant = dyn_cast<EnumConstantDecl>(D)) {
909 auto Info = Reader->lookupEnumConstant(EnumConstant->getName());
917 if (
auto ObjCContainer = dyn_cast<ObjCContainerDecl>(D->
getDeclContext())) {
920 -> std::optional<api_notes::ContextID> {
921 if (
auto Protocol = dyn_cast<ObjCProtocolDecl>(ObjCContainer)) {
922 if (
auto Found = Reader->lookupObjCProtocolID(Protocol->getName()))
928 if (
auto Impl = dyn_cast<ObjCCategoryImplDecl>(ObjCContainer)) {
929 if (
auto Cat = Impl->getCategoryDecl())
930 ObjCContainer = Cat->getClassInterface();
935 if (
auto Category = dyn_cast<ObjCCategoryDecl>(ObjCContainer)) {
937 ObjCContainer =
Category->getClassInterface();
942 if (
auto Impl = dyn_cast<ObjCImplDecl>(ObjCContainer)) {
943 if (Impl->getClassInterface())
944 ObjCContainer = Impl->getClassInterface();
949 if (
auto Class = dyn_cast<ObjCInterfaceDecl>(ObjCContainer)) {
950 if (
auto Found = Reader->lookupObjCClassID(
Class->getName()))
960 if (
auto Method = dyn_cast<ObjCMethodDecl>(D)) {
962 if (
auto Context = GetContext(Reader)) {
964 Selector Sel = Method->getSelector();
969 for (
unsigned i = 0, n = Sel.
getNumArgs(); i != n; ++i)
977 auto Info = Reader->lookupObjCMethod(*
Context, SelectorRef,
978 Method->isInstanceMethod());
985 if (
auto Property = dyn_cast<ObjCPropertyDecl>(D)) {
987 if (
auto Context = GetContext(Reader)) {
988 bool isInstanceProperty =
989 (
Property->getPropertyAttributesAsWritten() &
static void ProcessVersionedAPINotes(Sema &S, SpecificDecl *D, const api_notes::APINotesReader::VersionedInfo< SpecificInfo > Info)
Processes all versions of versioned API notes.
static bool checkAPINotesReplacementType(Sema &S, SourceLocation Loc, QualType OrigType, QualType ReplacementType)
Check that the replacement type provided by API notes is reasonable.
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 void handleAPINotedRetainCountConvention(Sema &S, Decl *D, VersionedInfoMetadata Metadata, std::optional< api_notes::RetainCountConventionKind > Convention)
static void handleAPINotedRetainCountAttribute(Sema &S, Decl *D, bool ShouldAddAttribute, VersionedInfoMetadata Metadata)
static AttributeCommonInfo getPlaceholderAttrInfo()
static void ProcessAPINotes(Sema &S, Decl *D, const api_notes::CommonEntityInfo &Info, VersionedInfoMetadata Metadata)
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 S...
static bool isIndirectPointerType(QualType Type)
Determine whether this is a multi-level pointer type.
Defines the clang::SourceLocation class and associated facilities.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
void * Allocate(size_t Size, unsigned Align=8) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
Attr - This represents one attribute.
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
bool isFileContext() const
bool isExternCXXContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
Decl - This represents one declaration (or definition), e.g.
attr_iterator attr_end() const
AttrVec::const_iterator attr_iterator
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
@ OBJC_TQ_CSNullability
The nullability qualifier is set when the nullability of the result or parameter was expressed via a ...
SourceLocation getLocation() const
DeclContext * getDeclContext()
An instance of this object exists for each enum constant that is defined.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static StringRef getImmediateMacroName(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
Retrieve the name of the immediate macro expansion.
ObjCContainerDecl - Represents a container for method declarations.
Represents an ObjC class declaration.
ObjCMethodDecl - Represents an instance or class method declaration.
unsigned param_size() const
void setReturnTypeSourceInfo(TypeSourceInfo *TInfo)
param_const_iterator param_begin() const
void setReturnType(QualType T)
QualType getReturnType() const
ObjCInterfaceDecl * getClassInterface()
Represents one property declaration in an Objective-C interface.
Represents a parameter to a function.
ParsedAttr - Represents a syntactic attribute.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
std::string getAsString() const
void * getAsOpaquePtr() const
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
bool isUnarySelector() const
unsigned getNumArgs() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Sema - This implements semantic analysis and AST building for C.
ASTContext & getASTContext() const
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
api_notes::APINotesManager APINotes
const LangOptions & LangOpts
std::function< TypeResult(StringRef, StringRef, SourceLocation)> ParseTypeFromStringCallback
Callback to the parser to parse a type expressed as a string.
bool CheckImplicitNullabilityTypeSpecifier(QualType &Type, NullabilityKind Nullability, SourceLocation DiagLoc, bool AllowArrayTypes, bool OverrideExisting)
Check whether a nullability type specifier can be added to the given type through some means not writ...
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
void ProcessAPINotes(Decl *D)
Map any API notes provided for this declaration to attributes on the declaration.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Encodes a location in the source.
A trivial tuple used to represent a source range.
Represents the declaration of a struct/union/class/enum.
The base class of the type hierarchy.
const T * castAs() const
Member-template castAs<specific type>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isMemberPointerType() const
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
void setType(QualType newType)
Represents a variable declaration or definition.
llvm::SmallVector< APINotesReader *, 2 > findAPINotes(SourceLocation Loc)
Find the API notes readers that correspond to the given source location.
Captures the completed versioned information for a particular part of API notes, including both unver...
unsigned size() const
Return the number of versioned results we know about.
std::optional< unsigned > getSelected() const
Retrieve the selected index in the result set.
A class that reads API notes data from a binary file that was written by the APINotesWriter.
Describes API notes data for any entity.
unsigned UnavailableInSwift
Whether this entity is marked unavailable in Swift.
unsigned Unavailable
Whether this entity is marked unavailable.
std::string SwiftName
Swift name of this entity.
std::string UnavailableMsg
Message to use when this entity is unavailable.
std::optional< bool > isSwiftPrivate() const
Describes API notes for types.
const std::optional< std::string > & getSwiftBridge() const
const std::optional< std::string > & getNSErrorDomain() const
Describes API notes data for an enumerator.
API notes for a function or method.
std::optional< RetainCountConventionKind > getRetainCountConvention() const
std::vector< ParamInfo > Params
The function parameters.
NullabilityKind getReturnTypeInfo() const
NullabilityKind getParamTypeInfo(unsigned index) const
std::string ResultType
The result type of this function, as a C type.
unsigned NullabilityAudited
Whether the signature has been audited with respect to nullability.
Describes API notes data for a global function.
Describes API notes data for a global variable.
Describes API notes data for an Objective-C class or protocol.
std::optional< bool > getSwiftObjCMembers() const
std::optional< bool > getSwiftImportAsNonGeneric() const
Describes API notes data for an Objective-C method.
unsigned DesignatedInit
Whether this is a designated initializer of its class.
Describes API notes data for an Objective-C property.
std::optional< bool > getSwiftImportAsAccessors() const
Describes a function or method parameter.
std::optional< bool > isNoEscape() const
std::optional< RetainCountConventionKind > getRetainCountConvention() const
Describes API notes data for a tag.
std::optional< std::string > SwiftReleaseOp
std::optional< std::string > SwiftRetainOp
std::optional< std::string > SwiftImportAs
std::optional< EnumExtensibilityKind > EnumExtensibility
std::optional< bool > isFlagEnum() const
std::optional< bool > isSwiftCopyable() const
Describes API notes data for a typedef.
std::optional< SwiftNewTypeKind > SwiftWrapper
API notes for a variable/property.
std::optional< NullabilityKind > getNullability() const
const std::string & getType() const
SwiftNewTypeKind
The kind of a swift_wrapper/swift_newtype.
EnumExtensibilityKind
The payload for an enum_extensibility attribute.
The JSON file list parser is used to communicate input to InstallAPI.
NullabilityKind
Describes the nullability of a particular type.
@ Property
The type of a property.
const FunctionProtoType * T
@ Class
The "class" keyword introduces the elaborated-type-specifier.
A temporary reference to an Objective-C selector, suitable for referencing selector data on the stack...
llvm::ArrayRef< llvm::StringRef > Identifiers