24enum class IsActive_t :
bool { Inactive, Active };
25enum class IsSubstitution_t :
bool { Original, Replacement };
27struct VersionedInfoMetadata {
30 unsigned IsActive : 1;
31 unsigned IsReplacement : 1;
33 VersionedInfoMetadata(VersionTuple Version, IsActive_t Active,
34 IsSubstitution_t Replacement)
35 : Version(Version), IsActive(Active == IsActive_t::Active),
36 IsReplacement(Replacement == IsSubstitution_t::Replacement) {}
52 VersionedInfoMetadata Metadata) {
53 if (!Metadata.IsActive)
63 return (QT.getTypePtr() != Original.getTypePtr()) ? std::optional(QT)
67 if (
auto Function = dyn_cast<FunctionDecl>(D)) {
69 GetModified(D,
Function->getReturnType(), Nullability)) {
73 *Modified, proto->getParamTypes(), proto->getExtProtoInfo()));
78 }
else if (
auto Method = dyn_cast<ObjCMethodDecl>(D)) {
79 if (
auto Modified = GetModified(D, Method->getReturnType(), Nullability)) {
80 Method->setReturnType(*Modified);
87 }
else if (
auto Value = dyn_cast<ValueDecl>(D)) {
88 if (
auto Modified = GetModified(D,
Value->
getType(), Nullability)) {
89 Value->setType(*Modified);
92 if (
auto Parm = dyn_cast<ParmVarDecl>(D)) {
98 }
else if (
auto Property = dyn_cast<ObjCPropertyDecl>(D)) {
99 if (
auto Modified = GetModified(D,
Property->getType(), Nullability)) {
112 void *mem = Ctx.
Allocate(String.size(),
alignof(
char *));
113 memcpy(mem, String.data(), String.size());
114 return StringRef(
static_cast<char *
>(mem), String.size());
126template <
typename A>
struct AttrKindFor {};
129 template <> struct AttrKindFor<X##Attr> { \
130 static const attr::Kind value = attr::X; \
132#include "clang/Basic/AttrList.inc"
140void handleAPINotedAttribute(
141 Sema &S,
Decl *D,
bool IsAddition, VersionedInfoMetadata Metadata,
142 llvm::function_ref<A *()> CreateAttr,
144 if (Metadata.IsActive) {
145 auto Existing = GetExistingAttr(D);
149 auto *Versioned = SwiftVersionedAdditionAttr::CreateImplicit(
150 S.
Context, Metadata.Version, *Existing,
true);
158 if (
auto Attr = CreateAttr())
165 if (
auto Attr = CreateAttr()) {
166 auto *Versioned = SwiftVersionedAdditionAttr::CreateImplicit(
168 Metadata.IsReplacement);
175 auto *Versioned = SwiftVersionedRemovalAttr::CreateImplicit(
176 S.
Context, Metadata.Version, AttrKindFor<A>::value,
177 Metadata.IsReplacement);
183void handleAPINotedAttribute(
Sema &S,
Decl *D,
bool ShouldAddAttribute,
184 VersionedInfoMetadata Metadata,
185 llvm::function_ref<A *()> CreateAttr) {
186 handleAPINotedAttribute<A>(
187 S, D, ShouldAddAttribute, Metadata, CreateAttr, [](
const Decl *D) {
188 return llvm::find_if(D->
attrs(),
189 [](
const Attr *Next) { return isa<A>(Next); });
196 bool ShouldAddAttribute,
197 VersionedInfoMetadata Metadata) {
200 handleAPINotedAttribute<A>(
201 S, D, ShouldAddAttribute, Metadata,
204 return llvm::find_if(D->
attrs(), [](
const Attr *Next) ->
bool {
205 return isa<CFReturnsRetainedAttr>(Next) ||
206 isa<CFReturnsNotRetainedAttr>(Next) ||
207 isa<NSReturnsRetainedAttr>(Next) ||
208 isa<NSReturnsNotRetainedAttr>(Next) ||
209 isa<CFAuditedTransferAttr>(Next);
215 Sema &S,
Decl *D, VersionedInfoMetadata Metadata,
216 std::optional<api_notes::RetainCountConventionKind> Convention) {
219 switch (*Convention) {
220 case api_notes::RetainCountConventionKind::None:
221 if (isa<FunctionDecl>(D)) {
222 handleAPINotedRetainCountAttribute<CFUnknownTransferAttr>(
223 S, D,
true, Metadata);
225 handleAPINotedRetainCountAttribute<CFReturnsRetainedAttr>(
226 S, D,
false, Metadata);
229 case api_notes::RetainCountConventionKind::CFReturnsRetained:
230 handleAPINotedRetainCountAttribute<CFReturnsRetainedAttr>(
231 S, D,
true, Metadata);
233 case api_notes::RetainCountConventionKind::CFReturnsNotRetained:
234 handleAPINotedRetainCountAttribute<CFReturnsNotRetainedAttr>(
235 S, D,
true, Metadata);
237 case api_notes::RetainCountConventionKind::NSReturnsRetained:
238 handleAPINotedRetainCountAttribute<NSReturnsRetainedAttr>(
239 S, D,
true, Metadata);
241 case api_notes::RetainCountConventionKind::NSReturnsNotRetained:
242 handleAPINotedRetainCountAttribute<NSReturnsNotRetainedAttr>(
243 S, D,
true, Metadata);
250 VersionedInfoMetadata Metadata) {
253 handleAPINotedAttribute<UnavailableAttr>(S, D,
true, Metadata, [&] {
261 handleAPINotedAttribute<AvailabilityAttr>(
262 S, D,
true, Metadata,
264 return new (S.
Context) AvailabilityAttr(
276 return llvm::find_if(D->
attrs(), [](
const Attr *next) ->
bool {
277 if (const auto *AA = dyn_cast<AvailabilityAttr>(next))
278 if (const auto *II = AA->getPlatform())
279 return II->isStr(
"swift");
287 handleAPINotedAttribute<SwiftPrivateAttr>(
288 S, D, *SwiftPrivate, Metadata, [&] {
296 handleAPINotedAttribute<SwiftNameAttr>(
297 S, D,
true, Metadata, [&]() -> SwiftNameAttr * {
302 AP.create(&
C.Idents.get(
"swift_name"),
SourceRange(),
nullptr,
304 ParsedAttr::Form::GNU());
319 VersionedInfoMetadata Metadata) {
322 handleAPINotedAttribute<SwiftBridgeAttr>(
323 S, D, !SwiftBridge->empty(), Metadata, [&] {
324 return new (S.Context)
325 SwiftBridgeAttr(S.Context, getPlaceholderAttrInfo(),
326 ASTAllocateString(S.Context, *SwiftBridge));
332 handleAPINotedAttribute<NSErrorDomainAttr>(
333 S, D, !NSErrorDomain->empty(), Metadata, [&] {
334 return new (S.Context)
335 NSErrorDomainAttr(S.Context, getPlaceholderAttrInfo(),
336 &S.Context.Idents.get(*NSErrorDomain));
352 S.
Diag(
Loc, diag::err_incompatible_replacement_type)
353 << ReplacementType << OrigType;
363 VersionedInfoMetadata Metadata) {
365 if (Metadata.IsActive && !Info.
getType().empty() &&
374 if (
auto Var = dyn_cast<VarDecl>(D)) {
376 if (isa<ParmVarDecl>(Var)) {
387 }
else if (
auto Property = dyn_cast<ObjCPropertyDecl>(D)) {
393 llvm_unreachable(
"API notes allowed a type on an unknown declaration");
409 VersionedInfoMetadata Metadata) {
412 handleAPINotedAttribute<NoEscapeAttr>(S, D, *NoEscape, Metadata, [&] {
428 VersionedInfoMetadata metadata) {
437 VersionedInfoMetadata Metadata) {
443 handleAPINotedAttribute<SwiftImportPropertyAsAccessorsAttr>(
444 S, D, *AsAccessors, Metadata, [&] {
445 return new (S.
Context) SwiftImportPropertyAsAccessorsAttr(
452typedef llvm::PointerUnion<FunctionDecl *, ObjCMethodDecl *> FunctionOrMethod;
458 VersionedInfoMetadata Metadata) {
468 assert((FD || MD) &&
"Expecting Function or ObjCMethod");
477 bool AnyTypeChanged =
false;
478 for (
unsigned I = 0; I != NumParams; ++I) {
482 if (I < Info.
Params.size())
490 AnyTypeChanged =
true;
495 if (Metadata.IsActive && !Info.
ResultType.empty() &&
498 Info.
ResultType,
"<API Notes>", D->getLocation());
505 auto ResultTypeInfo =
512 OverriddenResultType = ResultType;
513 AnyTypeChanged =
true;
520 if (FD && AnyTypeChanged) {
522 if (OverriddenResultType.
isNull())
523 OverriddenResultType = fnProtoType->getReturnType();
527 ParamTypes.push_back(Param->getType());
530 fnProtoType->getExtProtoInfo()));
531 }
else if (!OverriddenResultType.
isNull()) {
534 OverriddenResultType, FnNoProtoType->getExtInfo()));
550 VersionedInfoMetadata Metadata) {
559 VersionedInfoMetadata Metadata) {
568 VersionedInfoMetadata Metadata) {
571 handleAPINotedAttribute<ObjCDesignatedInitializerAttr>(
572 S, D,
true, Metadata, [&] {
574 IFace->setHasDesignatedInitializers();
576 return new (S.
Context) ObjCDesignatedInitializerAttr(
588 VersionedInfoMetadata Metadata) {
590 D->
addAttr(SwiftAttrAttr::Create(S.
Context,
"import_" + ImportAs.value()));
593 D->
addAttr(SwiftAttrAttr::Create(S.
Context,
"retain:" + RetainOp.value()));
597 SwiftAttrAttr::Create(S.
Context,
"release:" + ReleaseOp.value()));
606 bool ShouldAddAttribute = (*Extensibility != EnumExtensibilityKind::None);
607 handleAPINotedAttribute<EnumExtensibilityAttr>(
608 S, D, ShouldAddAttribute, Metadata, [&] {
609 EnumExtensibilityAttr::Kind kind;
610 switch (*Extensibility) {
611 case EnumExtensibilityKind::None:
612 llvm_unreachable(
"remove only");
613 case EnumExtensibilityKind::Open:
614 kind = EnumExtensibilityAttr::Open;
616 case EnumExtensibilityKind::Closed:
617 kind = EnumExtensibilityAttr::Closed;
626 handleAPINotedAttribute<FlagEnumAttr>(S, D, *FlagEnum, Metadata, [&] {
639 VersionedInfoMetadata Metadata) {
644 handleAPINotedAttribute<SwiftNewTypeAttr>(
645 S, D, *SwiftWrapper != SwiftWrapperKind::None, Metadata, [&] {
646 SwiftNewTypeAttr::NewtypeKind Kind;
647 switch (*SwiftWrapper) {
648 case SwiftWrapperKind::None:
649 llvm_unreachable(
"Shouldn't build an attribute");
651 case SwiftWrapperKind::Struct:
652 Kind = SwiftNewTypeAttr::NK_Struct;
655 case SwiftWrapperKind::Enum:
656 Kind = SwiftNewTypeAttr::NK_Enum;
661 AttributeCommonInfo::AT_SwiftNewType,
664 return new (S.
Context) SwiftNewTypeAttr(S.
Context, SyntaxInfo, Kind);
676 VersionedInfoMetadata Metadata) {
685 VersionedInfoMetadata Metadata) {
687 handleAPINotedAttribute<SwiftImportAsNonGenericAttr>(
688 S, D, *AsNonGeneric, Metadata, [&] {
695 handleAPINotedAttribute<SwiftObjCMembersAttr>(
696 S, D, *ObjcMembers, Metadata, [&] {
715template <
typename SpecificInfo>
719 if (D->
hasAttr<SwiftNameAttr>())
725 VersionTuple SelectedVersion;
726 SpecificInfo SelectedInfoSlice;
727 std::tie(SelectedVersion, SelectedInfoSlice) = Info[*Info.
getSelected()];
728 if (SelectedVersion.empty())
730 if (SelectedInfoSlice.SwiftName.empty())
734 for (
const auto &VersionAndInfoSlice : Info) {
735 if (!VersionAndInfoSlice.first.empty())
737 if (!VersionAndInfoSlice.second.SwiftName.empty())
742 VersionedInfoMetadata DummyFutureMetadata(
743 SelectedVersion, IsActive_t::Inactive, IsSubstitution_t::Replacement);
744 handleAPINotedAttribute<SwiftNameAttr>(
745 S, D,
false, DummyFutureMetadata, []() -> SwiftNameAttr * {
746 llvm_unreachable(
"should not try to add an attribute here");
753template <
typename SpecificDecl,
typename SpecificInfo>
755 Sema &S, SpecificDecl *D,
762 VersionTuple Version;
763 SpecificInfo InfoSlice;
764 for (
unsigned i = 0, e = Info.
size(); i != e; ++i) {
765 std::tie(Version, InfoSlice) = Info[i];
766 auto Active = (i == Selected) ? IsActive_t::Active : IsActive_t::Inactive;
767 auto Replacement = IsSubstitution_t::Original;
768 if (Active == IsActive_t::Inactive && Version.empty()) {
769 Replacement = IsSubstitution_t::Replacement;
770 Version = Info[Selected].first;
773 VersionedInfoMetadata(Version, Active, Replacement));
788 std::optional<api_notes::Context> APINotesContext;
789 if (
auto NamespaceContext = dyn_cast<NamespaceDecl>(D->
getDeclContext())) {
793 std::stack<NamespaceDecl *> NamespaceStack;
795 for (
auto CurrentNamespace = NamespaceContext; CurrentNamespace;
797 dyn_cast<NamespaceDecl>(CurrentNamespace->getParent())) {
798 if (!CurrentNamespace->isInlineNamespace())
799 NamespaceStack.push(CurrentNamespace);
802 std::optional<api_notes::ContextID> NamespaceID;
803 while (!NamespaceStack.empty()) {
804 auto CurrentNamespace = NamespaceStack.top();
805 NamespaceStack.pop();
806 NamespaceID = Reader->lookupNamespaceID(CurrentNamespace->getName(),
818 if (
auto VD = dyn_cast<VarDecl>(D)) {
821 Reader->lookupGlobalVariable(VD->getName(), APINotesContext);
829 if (
auto FD = dyn_cast<FunctionDecl>(D)) {
830 if (FD->getDeclName().isIdentifier()) {
833 Reader->lookupGlobalFunction(FD->getName(), APINotesContext);
842 if (
auto Class = dyn_cast<ObjCInterfaceDecl>(D)) {
844 auto Info = Reader->lookupObjCClassInfo(
Class->getName());
852 if (
auto Protocol = dyn_cast<ObjCProtocolDecl>(D)) {
854 auto Info = Reader->lookupObjCProtocolInfo(Protocol->getName());
862 if (
auto Tag = dyn_cast<TagDecl>(D)) {
863 std::string
LookupName = Tag->getName().str();
870 std::string MacroName =
871 LookupName.empty() && Tag->getOuterLocStart().isMacroID()
873 Tag->getOuterLocStart(),
874 Tag->getASTContext().getSourceManager(),
LangOpts)
878 if (
LookupName.empty() && isa<clang::EnumDecl>(Tag) &&
879 (MacroName ==
"CF_OPTIONS" || MacroName ==
"NS_OPTIONS" ||
880 MacroName ==
"OBJC_OPTIONS" || MacroName ==
"SWIFT_OPTIONS")) {
888 auto Info = Reader->lookupTag(
LookupName, APINotesContext);
896 if (
auto Typedef = dyn_cast<TypedefNameDecl>(D)) {
898 auto Info = Reader->lookupTypedef(Typedef->getName(), APINotesContext);
909 if (
auto EnumConstant = dyn_cast<EnumConstantDecl>(D)) {
911 auto Info = Reader->lookupEnumConstant(EnumConstant->getName());
919 if (
auto ObjCContainer = dyn_cast<ObjCContainerDecl>(D->
getDeclContext())) {
922 -> std::optional<api_notes::ContextID> {
923 if (
auto Protocol = dyn_cast<ObjCProtocolDecl>(ObjCContainer)) {
924 if (
auto Found = Reader->lookupObjCProtocolID(Protocol->getName()))
930 if (
auto Impl = dyn_cast<ObjCCategoryImplDecl>(ObjCContainer)) {
931 if (
auto Cat = Impl->getCategoryDecl())
932 ObjCContainer = Cat->getClassInterface();
937 if (
auto Category = dyn_cast<ObjCCategoryDecl>(ObjCContainer)) {
939 ObjCContainer =
Category->getClassInterface();
944 if (
auto Impl = dyn_cast<ObjCImplDecl>(ObjCContainer)) {
945 if (Impl->getClassInterface())
946 ObjCContainer = Impl->getClassInterface();
951 if (
auto Class = dyn_cast<ObjCInterfaceDecl>(ObjCContainer)) {
952 if (
auto Found = Reader->lookupObjCClassID(
Class->getName()))
962 if (
auto Method = dyn_cast<ObjCMethodDecl>(D)) {
964 if (
auto Context = GetContext(Reader)) {
966 Selector Sel = Method->getSelector();
971 for (
unsigned i = 0, n = Sel.
getNumArgs(); i != n; ++i)
979 auto Info = Reader->lookupObjCMethod(*
Context, SelectorRef,
980 Method->isInstanceMethod());
987 if (
auto Property = dyn_cast<ObjCPropertyDecl>(D)) {
989 if (
auto Context = GetContext(Reader)) {
990 bool isInstanceProperty =
991 (
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.
This file declares semantic analysis for Objective-C.
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.
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
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.
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