class ObjCProtocolDecl

Declaration

class ObjCProtocolDecl : public ObjCContainerDecl, public Redeclarable { /* full declaration omitted */ };

Description

Represents an Objective-C protocol declaration. Objective-C protocols declare a pure abstract type (i.e., no instance variables are permitted). Protocols originally drew inspiration from C++ pure virtual functions (a C++ feature with nice semantics and lousy syntax:-). Here is an example: This says that NSDraggingInfo requires two methods and requires everything that the two "referenced protocols" 'refproto1' and 'refproto2' require as well. ObjC protocols inspired Java interfaces. Unlike Java, ObjC classes and protocols are in distinct namespaces. For example, Cocoa defines both an NSObject protocol and class (which isn't allowed in Java). As a result, protocols are referenced using angle brackets as follows: id < NSDraggingInfo> anyObjectThatImplementsNSDraggingInfo;

Declared at: clang/include/clang/AST/DeclObjC.h:2052

Inherits from: ObjCContainerDecl, Redeclarable

Member Variables

private llvm::PointerIntPair<DefinitionData*, 1, bool> Data
The bit indicates when we don't need to check for out-of-date declarations. It will be set unless modules are enabled.

Inherited from DeclContext:

protected
protected FirstDecl = nullptr
protected LastDecl = nullptr

Inherited from Decl:

protected NextInContextAndBits
protected Access
protected FromASTFile
protected IdentifierNamespace
protected CacheValidAndLinkage

Method Overview

Inherited from ObjCContainerDecl:

Inherited from DeclContext:

Inherited from NamedDecl:

Inherited from Decl:

Methods

static clang::ObjCProtocolDecl* Create(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::IdentifierInfo* Id,
    clang::SourceLocation nameLoc,
    clang::SourceLocation atStartLoc,
    clang::ObjCProtocolDecl* PrevDecl)

Declared at: clang/include/clang/AST/DeclObjC.h:2101

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::IdentifierInfo* Id
clang::SourceLocation nameLoc
clang::SourceLocation atStartLoc
clang::ObjCProtocolDecl* PrevDecl

static clang::ObjCProtocolDecl*
CreateDeserialized(clang::ASTContext& C,
                   unsigned int ID)

Declared at: clang/include/clang/AST/DeclObjC.h:2107

Parameters

clang::ASTContext& C
unsigned int ID

ObjCProtocolDecl(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::IdentifierInfo* Id,
    clang::SourceLocation nameLoc,
    clang::SourceLocation atStartLoc,
    clang::ObjCProtocolDecl* PrevDecl)

Declared at: clang/include/clang/AST/DeclObjC.h:2069

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::IdentifierInfo* Id
clang::SourceLocation nameLoc
clang::SourceLocation atStartLoc
clang::ObjCProtocolDecl* PrevDecl

void allocateDefinitionData()

Declared at: clang/include/clang/AST/DeclObjC.h:2080

void anchor()

Declared at: clang/include/clang/AST/DeclObjC.h:2073

static bool classof(const clang::Decl* D)

Declared at: clang/include/clang/AST/DeclObjC.h:2256

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/DeclObjC.h:2257

Parameters

clang::Decl::Kind K

void collectInheritedProtocolProperties(
    const clang::ObjCPropertyDecl* Property,
    clang::ObjCContainerDecl::ProtocolPropertySet&
        PS,
    clang::ObjCContainerDecl::PropertyDeclOrder&
        PO) const

Declared at: clang/include/clang/AST/DeclObjC.h:2252

Parameters

const clang::ObjCPropertyDecl* Property
clang::ObjCContainerDecl::ProtocolPropertySet& PS
clang::ObjCContainerDecl::PropertyDeclOrder& PO

void collectPropertiesToImplement(
    clang::ObjCContainerDecl::PropertyMap& PM,
    clang::ObjCContainerDecl::PropertyDeclOrder&
        PO) const

Description

This routine collects list of properties to be implemented in the class. This includes, class's and its conforming protocols' properties. Note, the superclass's properties are not included in the list.

Declared at: clang/include/clang/AST/DeclObjC.h:2249

Parameters

clang::ObjCContainerDecl::PropertyMap& PM
clang::ObjCContainerDecl::PropertyDeclOrder& PO

clang::ObjCProtocolDecl::DefinitionData& data()
    const

Declared at: clang/include/clang/AST/DeclObjC.h:2075

const clang::ObjCProtocolDecl* getCanonicalDecl()
    const

Declared at: clang/include/clang/AST/DeclObjC.h:2247

clang::ObjCProtocolDecl* getCanonicalDecl()

Description

Retrieves the canonical declaration of this Objective-C protocol.

Declared at: clang/include/clang/AST/DeclObjC.h:2246

const clang::ObjCProtocolDecl* getDefinition()
    const

Description

Retrieve the definition of this protocol, if any.

Declared at: clang/include/clang/AST/DeclObjC.h:2211

clang::ObjCProtocolDecl* getDefinition()

Description

Retrieve the definition of this protocol, if any.

Declared at: clang/include/clang/AST/DeclObjC.h:2206

void getImpliedProtocols(
    llvm::DenseSet<const ObjCProtocolDecl*>& IPs)
    const

Description

Get the set of all protocols implied by this protocols inheritance hierarchy.

Declared at: clang/include/clang/AST/DeclObjC.h:2177

Parameters

llvm::DenseSet<const ObjCProtocolDecl*>& IPs

clang::ObjCProtocolDecl* getMostRecentDeclImpl()

Description

Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.

Declared at: clang/include/clang/AST/DeclObjC.h:2092

clang::ObjCProtocolDecl*
getNextRedeclarationImpl()

Description

Returns the next redeclaration or itself if this is the only decl. Decl subclasses that can be redeclared should override this method so that Decl::redecl_iterator can iterate over them.

Declared at: clang/include/clang/AST/DeclObjC.h:2084

llvm::StringRef getObjCRuntimeNameAsString() const

Description

Produce a name to be used for protocol's metadata. It comes either via objc_runtime_name attribute or protocol name.

Declared at: clang/include/clang/AST/DeclObjC.h:2226

clang::ObjCProtocolDecl* getPreviousDeclImpl()

Description

Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.

Declared at: clang/include/clang/AST/DeclObjC.h:2088

const clang::ObjCProtocolList&
getReferencedProtocols() const

Declared at: clang/include/clang/AST/DeclObjC.h:2109

clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/DeclObjC.h:2228

bool hasDefinition() const

Description

Determine whether this protocol has a definition.

Declared at: clang/include/clang/AST/DeclObjC.h:2194

bool isNonRuntimeProtocol() const

Description

This is true iff the protocol is tagged with the `objc_non_runtime_protocol` attribute.

Declared at: clang/include/clang/AST/DeclObjC.h:2173

bool isThisDeclarationADefinition() const

Description

Determine whether this particular declaration is also the definition.

Declared at: clang/include/clang/AST/DeclObjC.h:2217

clang::ObjCMethodDecl* lookupClassMethod(
    clang::Selector Sel) const

Declared at: clang/include/clang/AST/DeclObjC.h:2189

Parameters

clang::Selector Sel

clang::ObjCMethodDecl* lookupInstanceMethod(
    clang::Selector Sel) const

Declared at: clang/include/clang/AST/DeclObjC.h:2185

Parameters

clang::Selector Sel

clang::ObjCMethodDecl* lookupMethod(
    clang::Selector Sel,
    bool isInstance) const

Declared at: clang/include/clang/AST/DeclObjC.h:2183

Parameters

clang::Selector Sel
bool isInstance

clang::ObjCProtocolDecl* lookupProtocolNamed(
    clang::IdentifierInfo* PName)

Declared at: clang/include/clang/AST/DeclObjC.h:2179

Parameters

clang::IdentifierInfo* PName

clang::ObjCProtocolDecl::protocol_iterator
protocol_begin() const

Declared at: clang/include/clang/AST/DeclObjC.h:2121

clang::ObjCProtocolDecl::protocol_iterator
protocol_end() const

Declared at: clang/include/clang/AST/DeclObjC.h:2128

clang::ObjCProtocolDecl::protocol_loc_iterator
protocol_loc_begin() const

Declared at: clang/include/clang/AST/DeclObjC.h:2142

clang::ObjCProtocolDecl::protocol_loc_iterator
protocol_loc_end() const

Declared at: clang/include/clang/AST/DeclObjC.h:2149

clang::ObjCProtocolDecl::protocol_loc_range
protocol_locs() const

Declared at: clang/include/clang/AST/DeclObjC.h:2138

unsigned int protocol_size() const

Declared at: clang/include/clang/AST/DeclObjC.h:2156

clang::ObjCProtocolDecl::protocol_range
protocols() const

Declared at: clang/include/clang/AST/DeclObjC.h:2117

void setProtocolList(
    clang::ObjCProtocolDecl* const* List,
    unsigned int Num,
    const clang::SourceLocation* Locs,
    clang::ASTContext& C)

Description

setProtocolList - Set the list of protocols that this interface implements.

Declared at: clang/include/clang/AST/DeclObjC.h:2165

Parameters

clang::ObjCProtocolDecl* const* List
unsigned int Num
const clang::SourceLocation* Locs
clang::ASTContext& C

void startDefinition()

Description

Starts the definition of this Objective-C protocol.

Declared at: clang/include/clang/AST/DeclObjC.h:2222