clang 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::ObjCInterfaceDecl Class Reference

Represents an ObjC class declaration. More...

#include "clang/AST/DeclObjC.h"

Inheritance diagram for clang::ObjCInterfaceDecl:
Inheritance graph
[legend]

Classes

class  filtered_category_iterator
 Iterator that walks over the list of categories, filtering out those that do not meet specific criteria. More...
 

Public Types

using protocol_iterator = ObjCProtocolList::iterator
 
using protocol_range = llvm::iterator_range< protocol_iterator >
 
using protocol_loc_iterator = ObjCProtocolList::loc_iterator
 
using protocol_loc_range = llvm::iterator_range< protocol_loc_iterator >
 
using all_protocol_iterator = ObjCList< ObjCProtocolDecl >::iterator
 
using all_protocol_range = llvm::iterator_range< all_protocol_iterator >
 
using ivar_iterator = specific_decl_iterator< ObjCIvarDecl >
 
using ivar_range = llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > >
 
using visible_categories_iterator = filtered_category_iterator< isVisibleCategory >
 Iterator that walks over the list of categories and extensions that are visible, i.e., not hidden in a non-imported submodule.
 
using visible_categories_range = llvm::iterator_range< visible_categories_iterator >
 
using known_categories_iterator = filtered_category_iterator< isKnownCategory >
 Iterator that walks over all of the known categories and extensions, including those that are hidden.
 
using known_categories_range = llvm::iterator_range< known_categories_iterator >
 
using visible_extensions_iterator = filtered_category_iterator< isVisibleExtension >
 Iterator that walks over all of the visible extensions, skipping any that are known but hidden.
 
using visible_extensions_range = llvm::iterator_range< visible_extensions_iterator >
 
using known_extensions_iterator = filtered_category_iterator< isKnownExtension >
 Iterator that walks over all of the known extensions.
 
using known_extensions_range = llvm::iterator_range< known_extensions_iterator >
 
using redecl_range = redeclarable_base::redecl_range
 
using redecl_iterator = redeclarable_base::redecl_iterator
 
- Public Types inherited from clang::ObjCContainerDecl
using prop_iterator = specific_decl_iterator< ObjCPropertyDecl >
 
using prop_range = llvm::iterator_range< specific_decl_iterator< ObjCPropertyDecl > >
 
using instprop_iterator = filtered_decl_iterator< ObjCPropertyDecl, &ObjCPropertyDecl::isInstanceProperty >
 
using instprop_range = llvm::iterator_range< instprop_iterator >
 
using classprop_iterator = filtered_decl_iterator< ObjCPropertyDecl, &ObjCPropertyDecl::isClassProperty >
 
using classprop_range = llvm::iterator_range< classprop_iterator >
 
using method_iterator = specific_decl_iterator< ObjCMethodDecl >
 
using method_range = llvm::iterator_range< specific_decl_iterator< ObjCMethodDecl > >
 
using instmeth_iterator = filtered_decl_iterator< ObjCMethodDecl, &ObjCMethodDecl::isInstanceMethod >
 
using instmeth_range = llvm::iterator_range< instmeth_iterator >
 
using classmeth_iterator = filtered_decl_iterator< ObjCMethodDecl, &ObjCMethodDecl::isClassMethod >
 
using classmeth_range = llvm::iterator_range< classmeth_iterator >
 
using PropertyMap = llvm::MapVector< std::pair< IdentifierInfo *, unsigned >, ObjCPropertyDecl * >
 
using ProtocolPropertySet = llvm::SmallDenseSet< const ObjCProtocolDecl *, 8 >
 
using PropertyDeclOrder = llvm::SmallVector< ObjCPropertyDecl *, 8 >
 
- Public Types inherited from clang::NamedDecl
enum  ExplicitVisibilityKind { VisibilityForType , VisibilityForValue }
 Kinds of explicit visibility. More...
 
- Public Types inherited from clang::Decl
enum  Kind
 Lists the kind of concrete classes of Decl. More...
 
enum  IdentifierNamespace {
  IDNS_Label = 0x0001 , IDNS_Tag = 0x0002 , IDNS_Type = 0x0004 , IDNS_Member = 0x0008 ,
  IDNS_Namespace = 0x0010 , IDNS_Ordinary = 0x0020 , IDNS_ObjCProtocol = 0x0040 , IDNS_OrdinaryFriend = 0x0080 ,
  IDNS_TagFriend = 0x0100 , IDNS_Using = 0x0200 , IDNS_NonMemberOperator = 0x0400 , IDNS_LocalExtern = 0x0800 ,
  IDNS_OMPReduction = 0x1000 , IDNS_OMPMapper = 0x2000
}
 IdentifierNamespace - The different namespaces in which declarations may appear. More...
 
enum  ObjCDeclQualifier {
  OBJC_TQ_None = 0x0 , OBJC_TQ_In = 0x1 , OBJC_TQ_Inout = 0x2 , OBJC_TQ_Out = 0x4 ,
  OBJC_TQ_Bycopy = 0x8 , OBJC_TQ_Byref = 0x10 , OBJC_TQ_Oneway = 0x20 , OBJC_TQ_CSNullability = 0x40
}
 ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declarations. More...
 
enum class  ModuleOwnershipKind : unsigned char {
  Unowned , Visible , VisibleWhenImported , ReachableWhenImported ,
  ModulePrivate
}
 The kind of ownership a declaration has, for visibility purposes. More...
 
enum  FriendObjectKind { FOK_None , FOK_Declared , FOK_Undeclared }
 
using attr_iterator = AttrVec::const_iterator
 
using attr_range = llvm::iterator_range< attr_iterator >
 
using redecl_range = llvm::iterator_range< redecl_iterator >
 
- Public Types inherited from clang::DeclContext
using decl_range = llvm::iterator_range< decl_iterator >
 
using lookup_result = DeclContextLookupResult
 
using lookup_iterator = lookup_result::iterator
 
using lookups_range = llvm::iterator_range< all_lookups_iterator >
 
using udir_iterator_base = llvm::iterator_adaptor_base< udir_iterator, lookup_iterator, typename lookup_iterator::iterator_category, UsingDirectiveDecl * >
 
using udir_range = llvm::iterator_range< udir_iterator >
 
using ddiag_range = llvm::iterator_range< DeclContext::ddiag_iterator >
 
- Public Types inherited from clang::Redeclarable< ObjCInterfaceDecl >
using redecl_range = llvm::iterator_range< redecl_iterator >
 

Public Member Functions

ObjCTypeParamListgetTypeParamList () const
 Retrieve the type parameters of this class.
 
void setTypeParamList (ObjCTypeParamList *TPL)
 Set the type parameters of this class.
 
ObjCTypeParamListgetTypeParamListAsWritten () const
 Retrieve the type parameters written on this particular declaration of the class.
 
SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.
 
void setExternallyCompleted ()
 Indicate that this Objective-C class is complete, but that the external AST source will be responsible for filling in its contents when a complete class is required.
 
void setHasDesignatedInitializers ()
 Indicate that this interface decl contains at least one initializer marked with the 'objc_designated_initializer' attribute.
 
bool hasDesignatedInitializers () const
 Returns true if this interface decl contains at least one initializer marked with the 'objc_designated_initializer' attribute.
 
bool declaresOrInheritsDesignatedInitializers () const
 Returns true if this interface decl declares a designated initializer or it inherites one from its super class.
 
const ObjCProtocolListgetReferencedProtocols () const
 
ObjCImplementationDeclgetImplementation () const
 
void setImplementation (ObjCImplementationDecl *ImplD)
 
ObjCCategoryDeclFindCategoryDeclaration (const IdentifierInfo *CategoryId) const
 FindCategoryDeclaration - Finds category declaration in the list of categories for this class and returns it.
 
ObjCMethodDeclgetCategoryInstanceMethod (Selector Sel) const
 
ObjCMethodDeclgetCategoryClassMethod (Selector Sel) const
 
ObjCMethodDeclgetCategoryMethod (Selector Sel, bool isInstance) const
 
protocol_range protocols () const
 
protocol_iterator protocol_begin () const
 
protocol_iterator protocol_end () const
 
protocol_loc_range protocol_locs () const
 
protocol_loc_iterator protocol_loc_begin () const
 
protocol_loc_iterator protocol_loc_end () const
 
all_protocol_range all_referenced_protocols () const
 
all_protocol_iterator all_referenced_protocol_begin () const
 
all_protocol_iterator all_referenced_protocol_end () const
 
ivar_range ivars () const
 
ivar_iterator ivar_begin () const
 
ivar_iterator ivar_end () const
 
unsigned ivar_size () const
 
bool ivar_empty () const
 
ObjCIvarDeclall_declared_ivar_begin ()
 all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementation.
 
const ObjCIvarDeclall_declared_ivar_begin () const
 
void setIvarList (ObjCIvarDecl *ivar)
 
void setProtocolList (ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
 setProtocolList - Set the list of protocols that this interface implements.
 
void mergeClassExtensionProtocolList (ObjCProtocolDecl *const *List, unsigned Num, ASTContext &C)
 mergeClassExtensionProtocolList - Merge class extension's protocol list into the protocol list for this class.
 
StringRef getObjCRuntimeNameAsString () const
 Produce a name to be used for class's metadata.
 
void getDesignatedInitializers (llvm::SmallVectorImpl< const ObjCMethodDecl * > &Methods) const
 Returns the designated initializers for the interface.
 
bool isDesignatedInitializer (Selector Sel, const ObjCMethodDecl **InitMethod=nullptr) const
 Returns true if the given selector is a designated initializer for the interface.
 
bool isThisDeclarationADefinition () const
 Determine whether this particular declaration of this class is actually also a definition.
 
bool hasDefinition () const
 Determine whether this class has been defined.
 
ObjCInterfaceDeclgetDefinition ()
 Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) but not yet defined (with @interface).
 
const ObjCInterfaceDeclgetDefinition () const
 Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) but not yet defined (with @interface).
 
void startDefinition ()
 Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a definition (@interface).
 
void startDuplicateDefinitionForComparison ()
 Starts the definition without sharing it with other redeclarations.
 
void mergeDuplicateDefinitionWithCommon (const ObjCInterfaceDecl *Definition)
 
const ObjCObjectTypegetSuperClassType () const
 Retrieve the superclass type.
 
TypeSourceInfogetSuperClassTInfo () const
 
ObjCInterfaceDeclgetSuperClass () const
 
void setSuperClass (TypeSourceInfo *superClass)
 
visible_categories_range visible_categories () const
 
visible_categories_iterator visible_categories_begin () const
 Retrieve an iterator to the beginning of the visible-categories list.
 
visible_categories_iterator visible_categories_end () const
 Retrieve an iterator to the end of the visible-categories list.
 
bool visible_categories_empty () const
 Determine whether the visible-categories list is empty.
 
known_categories_range known_categories () const
 
known_categories_iterator known_categories_begin () const
 Retrieve an iterator to the beginning of the known-categories list.
 
known_categories_iterator known_categories_end () const
 Retrieve an iterator to the end of the known-categories list.
 
bool known_categories_empty () const
 Determine whether the known-categories list is empty.
 
visible_extensions_range visible_extensions () const
 
visible_extensions_iterator visible_extensions_begin () const
 Retrieve an iterator to the beginning of the visible-extensions list.
 
visible_extensions_iterator visible_extensions_end () const
 Retrieve an iterator to the end of the visible-extensions list.
 
bool visible_extensions_empty () const
 Determine whether the visible-extensions list is empty.
 
known_extensions_range known_extensions () const
 
known_extensions_iterator known_extensions_begin () const
 Retrieve an iterator to the beginning of the known-extensions list.
 
known_extensions_iterator known_extensions_end () const
 Retrieve an iterator to the end of the known-extensions list.
 
bool known_extensions_empty () const
 Determine whether the known-extensions list is empty.
 
ObjCCategoryDeclgetCategoryListRaw () const
 Retrieve the raw pointer to the start of the category/extension list.
 
void setCategoryListRaw (ObjCCategoryDecl *category)
 Set the raw pointer to the start of the category/extension list.
 
ObjCPropertyDeclFindPropertyVisibleInPrimaryClass (const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
 FindPropertyVisibleInPrimaryClass - Finds declaration of the property with name 'PropertyId' in the primary class; including those in protocols (direct or indirect) used by the primary class.
 
void collectPropertiesToImplement (PropertyMap &PM) const override
 This routine collects list of properties to be implemented in the class.
 
bool isSuperClassOf (const ObjCInterfaceDecl *I) const
 isSuperClassOf - Return true if this class is the specified class or is a super class of the specified interface class.
 
bool isArcWeakrefUnavailable () const
 isArcWeakrefUnavailable - Checks for a class or one of its super classes to be incompatible with __weak references.
 
const ObjCInterfaceDeclisObjCRequiresPropertyDefs () const
 isObjCRequiresPropertyDefs - Checks that a class or one of its super classes must not be auto-synthesized.
 
ObjCIvarDecllookupInstanceVariable (IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
 
ObjCIvarDecllookupInstanceVariable (IdentifierInfo *IVarName)
 
ObjCProtocolDecllookupNestedProtocol (IdentifierInfo *Name)
 
ObjCMethodDecllookupMethod (Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
 lookupMethod - This method returns an instance/class method by looking in the class, its categories, and its super classes (using a linear search).
 
ObjCMethodDecllookupInstanceMethod (Selector Sel) const
 Lookup an instance method for a given selector.
 
ObjCMethodDecllookupClassMethod (Selector Sel) const
 Lookup a class method for a given selector.
 
ObjCInterfaceDecllookupInheritedClass (const IdentifierInfo *ICName)
 lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super class whose name is passed as argument.
 
ObjCMethodDecllookupPrivateMethod (const Selector &Sel, bool Instance=true) const
 Lookup a method in the classes implementation hierarchy.
 
ObjCMethodDecllookupPrivateClassMethod (const Selector &Sel)
 
ObjCMethodDecllookupPropertyAccessor (const Selector Sel, const ObjCCategoryDecl *Cat, bool IsClassProperty) const
 Lookup a setter or getter in the class hierarchy, including in all categories except for category passed as argument.
 
SourceLocation getEndOfDefinitionLoc () const
 
void setEndOfDefinitionLoc (SourceLocation LE)
 
SourceLocation getSuperClassLoc () const
 Retrieve the starting location of the superclass.
 
bool isImplicitInterfaceDecl () const
 isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node.
 
bool ClassImplementsProtocol (ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
 ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class, its super class or categories (if lookupCategory is true).
 
ObjCInterfaceDeclgetCanonicalDecl () override
 Retrieves the canonical declaration of this Objective-C class.
 
const ObjCInterfaceDeclgetCanonicalDecl () const
 
const TypegetTypeForDecl () const
 
void setTypeForDecl (const Type *TD) const
 
unsigned getODRHash ()
 Get precomputed ODRHash or add a new one.
 
- Public Member Functions inherited from clang::ObjCContainerDecl
 ObjCContainerDecl (Kind DK, DeclContext *DC, const IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc)
 
prop_range properties () const
 
prop_iterator prop_begin () const
 
prop_iterator prop_end () const
 
instprop_range instance_properties () const
 
instprop_iterator instprop_begin () const
 
instprop_iterator instprop_end () const
 
classprop_range class_properties () const
 
classprop_iterator classprop_begin () const
 
classprop_iterator classprop_end () const
 
method_range methods () const
 
method_iterator meth_begin () const
 
method_iterator meth_end () const
 
instmeth_range instance_methods () const
 
instmeth_iterator instmeth_begin () const
 
instmeth_iterator instmeth_end () const
 
classmeth_range class_methods () const
 
classmeth_iterator classmeth_begin () const
 
classmeth_iterator classmeth_end () const
 
ObjCMethodDeclgetMethod (Selector Sel, bool isInstance, bool AllowHidden=false) const
 
ObjCMethodDeclgetInstanceMethod (Selector Sel, bool AllowHidden=false) const
 
ObjCMethodDeclgetClassMethod (Selector Sel, bool AllowHidden=false) const
 
bool HasUserDeclaredSetterMethod (const ObjCPropertyDecl *P) const
 This routine returns 'true' if a user declared setter method was found in the class, its protocols, its super classes or categories.
 
ObjCIvarDeclgetIvarDecl (IdentifierInfo *Id) const
 getIvarDecl - This method looks up an ivar in this ContextDecl.
 
ObjCPropertyDeclgetProperty (const IdentifierInfo *Id, bool IsInstance) const
 
ObjCPropertyDeclFindPropertyDeclaration (const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
 FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and returns it.
 
virtual void collectPropertiesToImplement (PropertyMap &PM) const
 This routine collects list of properties to be implemented in the class.
 
SourceLocation getAtStartLoc () const
 
void setAtStartLoc (SourceLocation Loc)
 
SourceRange getAtEndRange () const
 
void setAtEndRange (SourceRange atEnd)
 
SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.
 
- Public Member Functions inherited from clang::NamedDecl
IdentifierInfogetIdentifier () const
 Get the identifier that names this declaration, if there is one.
 
StringRef getName () const
 Get the name of identifier for this declaration as a StringRef.
 
std::string getNameAsString () const
 Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ constructor, Objective-C selector, etc).
 
virtual void printName (raw_ostream &OS, const PrintingPolicy &Policy) const
 Pretty-print the unqualified name of this declaration.
 
void printName (raw_ostream &OS) const
 Calls printName() with the ASTContext printing policy from the decl.
 
DeclarationName getDeclName () const
 Get the actual, stored name of the declaration, which may be a special name.
 
void setDeclName (DeclarationName N)
 Set the name of this declaration.
 
void printQualifiedName (raw_ostream &OS) const
 Returns a human-readable qualified name for this declaration, like A::B::i, for i being member of namespace A::B.
 
void printQualifiedName (raw_ostream &OS, const PrintingPolicy &Policy) const
 
void printNestedNameSpecifier (raw_ostream &OS) const
 Print only the nested name specifier part of a fully-qualified name, including the '::' at the end.
 
void printNestedNameSpecifier (raw_ostream &OS, const PrintingPolicy &Policy) const
 
std::string getQualifiedNameAsString () const
 
virtual void getNameForDiagnostic (raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
 Appends a human-readable name for this declaration into the given stream.
 
bool declarationReplaces (const NamedDecl *OldD, bool IsKnownNewer=true) const
 Determine whether this declaration, if known to be well-formed within its context, will replace the declaration OldD if introduced into scope.
 
bool hasLinkage () const
 Determine whether this declaration has linkage.
 
bool isCXXClassMember () const
 Determine whether this declaration is a C++ class member.
 
bool isCXXInstanceMember () const
 Determine whether the given declaration is an instance member of a C++ class.
 
ReservedIdentifierStatus isReserved (const LangOptions &LangOpts) const
 Determine if the declaration obeys the reserved identifier rules of the given language.
 
Linkage getLinkageInternal () const
 Determine what kind of linkage this entity has.
 
Linkage getFormalLinkage () const
 Get the linkage from a semantic point of view.
 
bool hasExternalFormalLinkage () const
 True if this decl has external linkage.
 
bool isExternallyVisible () const
 
bool isExternallyDeclarable () const
 Determine whether this declaration can be redeclared in a different translation unit.
 
Visibility getVisibility () const
 Determines the visibility of this entity.
 
LinkageInfo getLinkageAndVisibility () const
 Determines the linkage and visibility of this entity.
 
std::optional< VisibilitygetExplicitVisibility (ExplicitVisibilityKind kind) const
 If visibility was explicitly specified for this declaration, return that visibility.
 
bool isLinkageValid () const
 True if the computed linkage is valid.
 
bool hasLinkageBeenComputed () const
 True if something has required us to compute the linkage of this declaration.
 
bool isPlaceholderVar (const LangOptions &LangOpts) const
 
NamedDeclgetUnderlyingDecl ()
 Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
 
const NamedDeclgetUnderlyingDecl () const
 
NamedDeclgetMostRecentDecl ()
 
const NamedDeclgetMostRecentDecl () const
 
ObjCStringFormatFamily getObjCFStringFormattingFamily () const
 
bool isModulePrivate () const
 Whether this declaration was marked as being private to the module in which it was defined.
 
void setModulePrivate ()
 Specify that this declaration was marked as being private to the module in which it was defined.
 
- Public Member Functions inherited from clang::Decl
 Decl ()=delete
 
 Decl (const Decl &)=delete
 
 Decl (Decl &&)=delete
 
Decloperator= (const Decl &)=delete
 
Decloperator= (Decl &&)=delete
 
virtual SourceRange getSourceRange () const LLVM_READONLY
 Source range that this declaration covers.
 
SourceLocation getBeginLoc () const LLVM_READONLY
 
SourceLocation getEndLoc () const LLVM_READONLY
 
SourceLocation getLocation () const
 
void setLocation (SourceLocation L)
 
Kind getKind () const
 
const char * getDeclKindName () const
 
DeclgetNextDeclInContext ()
 
const DeclgetNextDeclInContext () const
 
DeclContextgetDeclContext ()
 
const DeclContextgetDeclContext () const
 
DeclContextgetNonTransparentDeclContext ()
 Return the non transparent context.
 
const DeclContextgetNonTransparentDeclContext () const
 
DeclgetNonClosureContext ()
 Find the innermost non-closure ancestor of this declaration, walking up through blocks, lambdas, etc.
 
const DeclgetNonClosureContext () const
 
TranslationUnitDeclgetTranslationUnitDecl ()
 
const TranslationUnitDeclgetTranslationUnitDecl () const
 
bool isInAnonymousNamespace () const
 
bool isInStdNamespace () const
 
bool isFileContextDecl () const
 
ASTContextgetASTContext () const LLVM_READONLY
 
const LangOptionsgetLangOpts () const LLVM_READONLY
 Helper to get the language options from the ASTContext.
 
void setAccess (AccessSpecifier AS)
 
AccessSpecifier getAccess () const
 
AccessSpecifier getAccessUnsafe () const
 Retrieve the access specifier for this declaration, even though it may not yet have been properly set.
 
bool hasAttrs () const
 
void setAttrs (const AttrVec &Attrs)
 
AttrVecgetAttrs ()
 
const AttrVecgetAttrs () const
 
void dropAttrs ()
 
void addAttr (Attr *A)
 
attr_range attrs () const
 
attr_iterator attr_begin () const
 
attr_iterator attr_end () const
 
template<typename... Ts>
void dropAttrs ()
 
template<typename T >
void dropAttr ()
 
template<typename T >
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs () const
 
template<typename T >
specific_attr_iterator< Tspecific_attr_begin () const
 
template<typename T >
specific_attr_iterator< Tspecific_attr_end () const
 
template<typename