;
29enum classIsActive_t :
bool{ Inactive, Active };
30enum classIsSubstitution_t :
bool{ Original, Replacement };
32structVersionedInfoMetadata {
35 unsignedIsActive : 1;
36 unsignedIsReplacement : 1;
38VersionedInfoMetadata(VersionTuple Version, IsActive_t Active,
39IsSubstitution_t Replacement)
40: Version(Version), IsActive(Active == IsActive_t::Active),
41IsReplacement(Replacement == IsSubstitution_t::Replacement) {}
57VersionedInfoMetadata Metadata) {
58 if(!Metadata.IsActive)
66isa<ParmVarDecl>(
D),
68 return(QT.getTypePtr() != Original.getTypePtr()) ? std::optional(QT)
72 if(
auto Function= dyn_cast<FunctionDecl>(
D)) {
74GetModified(
D,
Function->getReturnType(), Nullability)) {
78*Modified, proto->getParamTypes(), proto->getExtProtoInfo()));
83}
else if(
autoMethod = dyn_cast<ObjCMethodDecl>(
D)) {
84 if(
autoModified = GetModified(
D, Method->getReturnType(), Nullability)) {
85Method->setReturnType(*Modified);
92}
else if(
auto Value= dyn_cast<ValueDecl>(
D)) {
93 if(
autoModified = GetModified(
D,
Value->
getType(), Nullability)) {
94 Value->setType(*Modified);
97 if(
autoParm = dyn_cast<ParmVarDecl>(
D)) {
103}
else if(
auto Property= dyn_cast<ObjCPropertyDecl>(
D)) {
104 if(
autoModified = GetModified(
D,
Property->getType(), Nullability)) {
117 void*mem = Ctx.
Allocate(String.size(),
alignof(
char*));
118 memcpy(mem, String.data(), String.size());
119 returnStringRef(
static_cast<char*
>(mem), String.size());
131template<
typenameA>
structAttrKindFor {};
134 template <> struct AttrKindFor<X##Attr> { \ 135 static const attr::Kind value = attr::X; \ 137#include "clang/Basic/AttrList.inc" 144template<
typenameA>
145voidhandleAPINotedAttribute(
146 Sema&S,
Decl*
D,
boolIsAddition, VersionedInfoMetadata Metadata,
147llvm::function_ref<A *()> CreateAttr,
149 if(Metadata.IsActive) {
150 autoExisting = GetExistingAttr(
D);
154 auto*Versioned = SwiftVersionedAdditionAttr::CreateImplicit(
155S.
Context, Metadata.Version, *Existing,
true);
163 if(
auto Attr= CreateAttr())
170 if(
auto Attr= CreateAttr()) {
171 auto*Versioned = SwiftVersionedAdditionAttr::CreateImplicit(
173Metadata.IsReplacement);
180 auto*Versioned = SwiftVersionedRemovalAttr::CreateImplicit(
181S.
Context, Metadata.Version, AttrKindFor<A>::value,
182Metadata.IsReplacement);
187template<
typenameA>
188voidhandleAPINotedAttribute(
Sema&S,
Decl*
D,
boolShouldAddAttribute,
189VersionedInfoMetadata Metadata,
190llvm::function_ref<A *()> CreateAttr) {
191handleAPINotedAttribute<A>(
192S,
D, ShouldAddAttribute, Metadata, CreateAttr, [](
const Decl*
D) {
193 returnllvm::find_if(
D->
attrs(),
194[](
const Attr*Next) { return isa<A>(Next); });
199template<
typenameA>
201 boolShouldAddAttribute,
202VersionedInfoMetadata Metadata) {
205handleAPINotedAttribute<A>(
206S,
D, ShouldAddAttribute, Metadata,
209 returnllvm::find_if(
D->
attrs(), [](
const Attr*Next) ->
bool{
210return isa<CFReturnsRetainedAttr>(Next) ||
211isa<CFReturnsNotRetainedAttr>(Next) ||
212isa<NSReturnsRetainedAttr>(Next) ||
213isa<NSReturnsNotRetainedAttr>(Next) ||
214isa<CFAuditedTransferAttr>(Next);
220 Sema&S,
Decl*
D, VersionedInfoMetadata Metadata,
221std::optional<api_notes::RetainCountConventionKind> Convention) {
224 switch(*Convention) {
225 caseapi_notes::RetainCountConventionKind::None:
226 if(isa<FunctionDecl>(
D)) {
227handleAPINotedRetainCountAttribute<CFUnknownTransferAttr>(
228S,
D,
true, Metadata);
230handleAPINotedRetainCountAttribute<CFReturnsRetainedAttr>(
231S,
D,
false, Metadata);
234 caseapi_notes::RetainCountConventionKind::CFReturnsRetained:
235handleAPINotedRetainCountAttribute<CFReturnsRetainedAttr>(
236S,
D,
true, Metadata);
238 caseapi_notes::RetainCountConventionKind::CFReturnsNotRetained:
239handleAPINotedRetainCountAttribute<CFReturnsNotRetainedAttr>(
240S,
D,
true, Metadata);
242 caseapi_notes::RetainCountConventionKind::NSReturnsRetained:
243handleAPINotedRetainCountAttribute<NSReturnsRetainedAttr>(
244S,
D,
true, Metadata);
246 caseapi_notes::RetainCountConventionKind::NSReturnsNotRetained:
247handleAPINotedRetainCountAttribute<NSReturnsNotRetainedAttr>(
248S,
D,
true, Metadata);
255VersionedInfoMetadata Metadata) {
258handleAPINotedAttribute<UnavailableAttr>(S,
D,
true, Metadata, [&] {
266handleAPINotedAttribute<AvailabilityAttr>(
267S,
D,
true, Metadata,
269 return new(S.
Context) AvailabilityAttr(
280[](
const Decl*
D) {
281 returnllvm::find_if(
D->
attrs(), [](
const Attr*next) ->
bool{
282if (const auto *AA = dyn_cast<AvailabilityAttr>(next))
283if (const auto *II = AA->getPlatform())
284return II->isStr(
"swift");
292handleAPINotedAttribute<SwiftPrivateAttr>(
293S,
D, *SwiftPrivate, Metadata, [&] {
301handleAPINotedAttribute<SwiftNameAttr>(
302S,
D,
true, Metadata, [&]() -> SwiftNameAttr * {
307AP.create(&
C.Idents.get(
"swift_name"),
SourceRange(),
nullptr,
309ParsedAttr::Form::GNU());
324VersionedInfoMetadata Metadata) {
327handleAPINotedAttribute<SwiftBridgeAttr>(
328S,
D, !SwiftBridge->empty(), Metadata, [&] {
329return new (S.Context)
330SwiftBridgeAttr(S.Context, getPlaceholderAttrInfo(),
331ASTAllocateString(S.Context, *SwiftBridge));
337handleAPINotedAttribute<NSErrorDomainAttr>(
338S,
D, !NSErrorDomain->empty(), Metadata, [&] {
339return new (S.Context)
340NSErrorDomainAttr(S.Context, getPlaceholderAttrInfo(),
341&S.Context.Idents.get(*NSErrorDomain));
357S.
Diag(
Loc, diag::err_incompatible_replacement_type)
358<< ReplacementType << OrigType;
368VersionedInfoMetadata Metadata) {
370 if(Metadata.IsActive && !Info.
getType().empty() &&
379 if(
autoVar = dyn_cast<VarDecl>(
D)) {
381 if(isa<ParmVarDecl>(Var)) {
389Var->setType(
Type);
392}
else if(
auto Property= dyn_cast<ObjCPropertyDecl>(
D)) {
398llvm_unreachable(
"API notes allowed a type on an unknown declaration");
414VersionedInfoMetadata Metadata) {
417handleAPINotedAttribute<NoEscapeAttr>(S,
D, *NoEscape, Metadata, [&] {
422handleAPINotedAttribute<LifetimeBoundAttr>(
423S,
D, *Lifetimebound, Metadata, [&] {
440VersionedInfoMetadata metadata) {
449VersionedInfoMetadata metadata) {
458VersionedInfoMetadata Metadata) {
464handleAPINotedAttribute<SwiftImportPropertyAsAccessorsAttr>(
465S,
D, *AsAccessors, Metadata, [&] {
466 return new(S.
Context) SwiftImportPropertyAsAccessorsAttr(
473typedefllvm::PointerUnion<FunctionDecl *, ObjCMethodDecl *> FunctionOrMethod;
479VersionedInfoMetadata Metadata) {
485MD = cast<ObjCMethodDecl *>(AnyFunc);
489assert((FD || MD) &&
"Expecting Function or ObjCMethod");
498 boolAnyTypeChanged =
false;
499 for(
unsignedI = 0; I != NumParams; ++I) {
503 if(I < Info.
Params.size())
511AnyTypeChanged =
true;
521 if(Metadata.IsActive && !Info.
ResultType.empty() &&
531 autoResultTypeInfo =
538OverriddenResultType = ResultType;
539AnyTypeChanged =
true;
546 if(FD && AnyTypeChanged) {
548 if(OverriddenResultType.
isNull())
549OverriddenResultType = fnProtoType->getReturnType();
553ParamTypes.push_back(Param->getType());
556fnProtoType->getExtProtoInfo()));
557}
else if(!OverriddenResultType.
isNull()) {
560OverriddenResultType, FnNoProtoType->getExtInfo()));
576VersionedInfoMetadata Metadata) {
577 if(Info.
This&& Info.
This->isLifetimebound() &&
579 autoMethodType = Method->
getType();
598VersionedInfoMetadata Metadata) {
607VersionedInfoMetadata Metadata) {
616VersionedInfoMetadata Metadata) {
619handleAPINotedAttribute<ObjCDesignatedInitializerAttr>(
620S,
D,
true, Metadata, [&] {
622IFace->setHasDesignatedInitializers();
624 returnnew (S.
Context) ObjCDesignatedInitializerAttr(
636VersionedInfoMetadata Metadata) {
638 D->
addAttr(SwiftAttrAttr::Create(S.
Context,
"import_"+ ImportAs.value()));
641 D->
addAttr(SwiftAttrAttr::Create(S.
Context,
"retain:"+ RetainOp.value()));
645SwiftAttrAttr::Create(S.
Context,
"release:"+ ReleaseOp.value()));
649SwiftAttrAttr::Create(S.
Context,
"conforms_to:"+ ConformsTo.value()));
658*Escapable ?
"Escapable":
"~Escapable"));
663 boolShouldAddAttribute = (*Extensibility != EnumExtensibilityKind::None);
664handleAPINotedAttribute<EnumExtensibilityAttr>(
665S,
D, ShouldAddAttribute, Metadata, [&] {
666EnumExtensibilityAttr::Kind kind;
667 switch(*Extensibility) {
668 caseEnumExtensibilityKind::None:
669llvm_unreachable(
"remove only");
670 caseEnumExtensibilityKind::Open:
671kind = EnumExtensibilityAttr::Open;
673 caseEnumExtensibilityKind::Closed:
674kind = EnumExtensibilityAttr::Closed;
683handleAPINotedAttribute<FlagEnumAttr>(S,
D, *FlagEnum, Metadata, [&] {
696VersionedInfoMetadata Metadata) {
701handleAPINotedAttribute<SwiftNewTypeAttr>(
702S,
D, *SwiftWrapper != SwiftWrapperKind::None, Metadata, [&] {
703SwiftNewTypeAttr::NewtypeKind Kind;
704 switch(*SwiftWrapper) {
705 caseSwiftWrapperKind::None:
706llvm_unreachable(
"Shouldn't build an attribute");
708 caseSwiftWrapperKind::Struct:
709Kind = SwiftNewTypeAttr::NK_Struct;
712 caseSwiftWrapperKind::Enum:
713Kind = SwiftNewTypeAttr::NK_Enum;
718AttributeCommonInfo::AT_SwiftNewType,
721 return new(S.
Context) SwiftNewTypeAttr(S.
Context, SyntaxInfo, Kind);
733VersionedInfoMetadata Metadata) {
742VersionedInfoMetadata Metadata) {
744handleAPINotedAttribute<SwiftImportAsNonGenericAttr>(
745S,
D, *AsNonGeneric, Metadata, [&] {
752handleAPINotedAttribute<SwiftObjCMembersAttr>(
753S,
D, *ObjcMembers, Metadata, [&] {
772template<
typenameSpecificInfo>
776 if(
D->
hasAttr<SwiftNameAttr>())
782VersionTuple SelectedVersion;
783SpecificInfo SelectedInfoSlice;
784std::tie(SelectedVersion, SelectedInfoSlice) = Info[*Info.
getSelected()];
785 if(SelectedVersion.empty())
787 if(SelectedInfoSlice.SwiftName.empty())
791 for(
const auto&VersionAndInfoSlice : Info) {
792 if(!VersionAndInfoSlice.first.empty())
794 if(!VersionAndInfoSlice.second.SwiftName.empty())
799VersionedInfoMetadata DummyFutureMetadata(
800SelectedVersion, IsActive_t::Inactive, IsSubstitution_t::Replacement);
801handleAPINotedAttribute<SwiftNameAttr>(
802S,
D,
false, DummyFutureMetadata, []() -> SwiftNameAttr * {
803llvm_unreachable(
"should not try to add an attribute here");
810template<
typenameSpecificDecl,
typenameSpecificInfo>
812 Sema&S, SpecificDecl *
D,
819VersionTuple Version;
820SpecificInfo InfoSlice;
821 for(
unsignedi = 0, e = Info.
size(); i != e; ++i) {
822std::tie(Version, InfoSlice) = Info[i];
823 autoActive = (i == Selected) ? IsActive_t::Active : IsActive_t::Inactive;
824 autoReplacement = IsSubstitution_t::Original;
825 if(Active == IsActive_t::Inactive && Version.empty()) {
826Replacement = IsSubstitution_t::Replacement;
827Version = Info[Selected].first;
830VersionedInfoMetadata(Version, Active, Replacement));
834staticstd::optional<api_notes::Context>
836 if(
autoNamespaceContext = dyn_cast<NamespaceDecl>(DC)) {
837 for(
autoReader : APINotes.
findAPINotes(NamespaceContext->getLocation())) {
839std::stack<NamespaceDecl *> NamespaceStack;
841 for(
autoCurrentNamespace = NamespaceContext; CurrentNamespace;
843dyn_cast<NamespaceDecl>(CurrentNamespace->getParent())) {
844 if(!CurrentNamespace->isInlineNamespace())
845NamespaceStack.push(CurrentNamespace);
848std::optional<api_notes::ContextID> NamespaceID;
849 while(!NamespaceStack.empty()) {
850 autoCurrentNamespace = NamespaceStack.top();
851NamespaceStack.pop();
853Reader->lookupNamespaceID(CurrentNamespace->getName(), NamespaceID);
859api_notes::ContextKind::Namespace);
865staticstd::optional<api_notes::Context>
867assert(DC &&
"tag context must not be null");
870std::stack<TagDecl *> TagStack;
872 for(
autoCurrentTag = DC; CurrentTag;
873CurrentTag = dyn_cast<TagDecl>(CurrentTag->getParent()))
874TagStack.push(CurrentTag);
876assert(!TagStack.empty());
877std::optional<api_notes::Context> Ctx =
879 while(!TagStack.empty()) {
880 autoCurrentTag = TagStack.top();
882 autoCtxID = Reader->lookupTagID(CurrentTag->getName(), Ctx);
900 if(DC->isFileContext() || DC->isNamespace() || DC->isExternCContext() ||
901DC->isExternCXXContext()) {
902std::optional<api_notes::Context> APINotesContext =
905 if(
autoVD = dyn_cast<VarDecl>(
D)) {
908Reader->lookupGlobalVariable(VD->getName(), APINotesContext);
916 if(
autoFD = dyn_cast<FunctionDecl>(
D)) {
917 if(FD->getDeclName().isIdentifier()) {
920Reader->lookupGlobalFunction(FD->getName(), APINotesContext);
929 if(
auto Class= dyn_cast<ObjCInterfaceDecl>(
D)) {
931 autoInfo = Reader->lookupObjCClassInfo(
Class->getName());
939 if(
autoProtocol = dyn_cast<ObjCProtocolDecl>(
D)) {
941 autoInfo = Reader->lookupObjCProtocolInfo(Protocol->getName());
949 if(
autoTag = dyn_cast<TagDecl>(
D)) {
955 if(
autotypedefName = Tag->getTypedefNameForAnonDecl())
965std::string MacroName =
966 LookupName.empty() && Tag->getOuterLocStart().isMacroID()
968Tag->getOuterLocStart(),
969Tag->getASTContext().getSourceManager(),
LangOpts)
973 if(
LookupName.empty() && isa<clang::EnumDecl>(Tag) &&
974(MacroName ==
"CF_OPTIONS"|| MacroName ==
"NS_OPTIONS"||
975MacroName ==
"OBJC_OPTIONS"|| MacroName ==
"SWIFT_OPTIONS")) {
983 if(
autoParentTag = dyn_cast<TagDecl>(Tag->getDeclContext()))
985 autoInfo = Reader->lookupTag(
LookupName, APINotesContext);
993 if(
autoTypedef = dyn_cast<TypedefNameDecl>(
D)) {
995 autoInfo = Reader->lookupTypedef(Typedef->getName(), APINotesContext);
1004 if(DC->getRedeclContext()->isFileContext() ||
1005DC->getRedeclContext()->isExternCContext()) {
1006 if(
autoEnumConstant = dyn_cast<EnumConstantDecl>(
D)) {
1008 autoInfo = Reader->lookupEnumConstant(EnumConstant->getName());
1016 if(
autoObjCContainer = dyn_cast<ObjCContainerDecl>(DC)) {
1019-> std::optional<api_notes::ContextID> {
1020 if(
autoProtocol = dyn_cast<ObjCProtocolDecl>(ObjCContainer)) {
1021 if(
auto Found= Reader->lookupObjCProtocolID(Protocol->getName()))
1024 returnstd::nullopt;
1027 if(
autoImpl = dyn_cast<ObjCCategoryImplDecl>(ObjCContainer)) {
1028 if(
autoCat = Impl->getCategoryDecl())
1029ObjCContainer = Cat->getClassInterface();
1031 returnstd::nullopt;
1034 if(
auto Category= dyn_cast<ObjCCategoryDecl>(ObjCContainer)) {
1035 if(
Category->getClassInterface())
1036ObjCContainer =
Category->getClassInterface();
1038 returnstd::nullopt;
1041 if(
autoImpl = dyn_cast<ObjCImplDecl>(ObjCContainer)) {
1042 if(Impl->getClassInterface())
1043ObjCContainer = Impl->getClassInterface();
1045 returnstd::nullopt;
1048 if(
auto Class= dyn_cast<ObjCInterfaceDecl>(ObjCContainer)) {
1049 if(
auto Found= Reader->lookupObjCClassID(
Class->getName()))
1052 returnstd::nullopt;
1055 returnstd::nullopt;
1059 if(
autoMethod = dyn_cast<ObjCMethodDecl>(
D)) {
1061 if(
auto Context= GetContext(Reader)) {
1063 SelectorSel = Method->getSelector();
1068 for(
unsignedi = 0, n = Sel.
getNumArgs(); i != n; ++i)
1076 autoInfo = Reader->lookupObjCMethod(*
Context, SelectorRef,
1077Method->isInstanceMethod());
1084 if(
auto Property= dyn_cast<ObjCPropertyDecl>(
D)) {
1086 if(
auto Context= GetContext(Reader)) {
1087 boolisInstanceProperty =
1088(
Property->getPropertyAttributesAsWritten() &
1090 autoInfo = Reader->lookupObjCProperty(*
Context,
Property->getName(),
1091isInstanceProperty);
1100 if(
autoTagContext = dyn_cast<TagDecl>(DC)) {
1101 if(
autoCXXMethod = dyn_cast<CXXMethodDecl>(
D)) {
1102 if(!isa<CXXConstructorDecl>(CXXMethod) &&
1103!isa<CXXDestructorDecl>(CXXMethod) &&
1104!isa<CXXConversionDecl>(CXXMethod) &&
1105!CXXMethod->isOverloadedOperator()) {
1109Reader->lookupCXXMethod(
Context->id, CXXMethod->getName());
1116 if(
autoField = dyn_cast<FieldDecl>(
D)) {
1117 if(!Field->isUnnamedBitField() && !Field->isAnonymousStructOrUnion()) {
1120 autoInfo = Reader->lookupField(
Context->id, Field->getName());
1127 if(
autoTag = dyn_cast<TagDecl>(
D)) {
1130 autoInfo = Reader->lookupTag(Tag->getName(),
Context);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static std::optional< api_notes::Context > UnwindNamespaceContext(DeclContext *DC, api_notes::APINotesManager &APINotes)
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 std::optional< api_notes::Context > UnwindTagContext(TagDecl *DC, api_notes::APINotesManager &APINotes)
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.
This file declares semantic analysis functions specific to Swift.
Defines the clang::SourceLocation class and associated facilities.
Defines the clang::TypeLoc interface and its subclasses.
__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 getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
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.
@ AS_GNU
attribute((...))
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
Type source information for an attributed type.
void setAttr(const Attr *A)
An attributed type is a type to which a type attribute has been applied.
Represents a static or instance method of a struct/union/class.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
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()
void setTypeSourceInfo(TypeSourceInfo *TI)
TypeSourceInfo * getTypeSourceInfo() const
An instance of this object exists for each enum constant that is defined.
Represents a member of a struct/union/class.
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
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)
bool DiagnoseName(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...
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.
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.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
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.
The API notes manager helps find API notes associated with declarations.
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 a C++ method.
std::optional< ParamInfo > This
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 Objective-C class or protocol or a C++ namespace.
std::optional< bool > getSwiftImportAsNonGeneric() const
std::optional< bool > getSwiftObjCMembers() const
Describes API notes data for an enumerator.
Describes API notes data for a C/C++ record field.
API notes for a function or method.
std::string SwiftReturnOwnership
Ownership convention for return value.
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 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< bool > isLifetimebound() 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
std::optional< bool > isSwiftEscapable() const
std::optional< std::string > SwiftConformance
The Swift protocol that this type should be automatically conformed to.
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.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
bool implicitObjectParamIsLifetimeBound(const FunctionDecl *FD)
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4