clang API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::ObjCProtocolDecl Class Reference

Represents an Objective-C protocol declaration. More...

#include <DeclObjC.h>

Inheritance diagram for clang::ObjCProtocolDecl:
Inheritance graph
[legend]
Collaboration diagram for clang::ObjCProtocolDecl:
Collaboration graph
[legend]

List of all members.

Classes

struct  DefinitionData

Public Types

typedef ObjCProtocolList::iterator protocol_iterator
typedef llvm::iterator_range
< protocol_iterator
protocol_range
typedef
ObjCProtocolList::loc_iterator 
protocol_loc_iterator
typedef llvm::iterator_range
< protocol_loc_iterator
protocol_loc_range
typedef
redeclarable_base::redecl_range 
redecl_range
typedef
redeclarable_base::redecl_iterator 
redecl_iterator

Public Member Functions

const ObjCProtocolListgetReferencedProtocols () 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
unsigned protocol_size () const
void setProtocolList (ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
ObjCProtocolDecllookupProtocolNamed (IdentifierInfo *PName)
ObjCMethodDecllookupMethod (Selector Sel, bool isInstance) const
ObjCMethodDecllookupInstanceMethod (Selector Sel) const
ObjCMethodDecllookupClassMethod (Selector Sel) const
bool hasDefinition () const
 Determine whether this protocol has a definition.
ObjCProtocolDeclgetDefinition ()
 Retrieve the definition of this protocol, if any.
const ObjCProtocolDeclgetDefinition () const
 Retrieve the definition of this protocol, if any.
bool isThisDeclarationADefinition () const
 Determine whether this particular declaration is also the definition.
void startDefinition ()
 Starts the definition of this Objective-C protocol.
StringRef getObjCRuntimeNameAsString () const
SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.
ObjCProtocolDeclgetCanonicalDecl () override
 Retrieves the canonical declaration of this Objective-C protocol.
const ObjCProtocolDeclgetCanonicalDecl () const
void collectPropertiesToImplement (PropertyMap &PM, PropertyDeclOrder &PO) const override
void collectInheritedProtocolProperties (const ObjCPropertyDecl *Property, ProtocolPropertyMap &PM) const

Static Public Member Functions

static ObjCProtocolDeclCreate (ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
static ObjCProtocolDeclCreateDeserialized (ASTContext &C, unsigned ID)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Friends

class ASTReader
class ASTDeclReader
class ASTDeclWriter

Detailed 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:

 \@protocol NSDraggingInfo <refproto1, refproto2>
 - (NSWindow *)draggingDestinationWindow;
 - (NSImage *)draggedImage;
 \@end

This says that NSDraggingInfo requires two methods and requires everything that the two "referenced protocols" 'refproto1' and 'refproto2' require as well.

 \@interface ImplementsNSDraggingInfo : NSObject \<NSDraggingInfo>
 \@end

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;

Definition at line 1507 of file DeclObjC.h.


Member Typedef Documentation

Definition at line 1561 of file DeclObjC.h.

Definition at line 1579 of file DeclObjC.h.

Definition at line 1580 of file DeclObjC.h.

Definition at line 1562 of file DeclObjC.h.

typedef redeclarable_base::redecl_iterator clang::ObjCProtocolDecl::redecl_iterator

Definition at line 1672 of file DeclObjC.h.

Reimplemented from clang::Redeclarable< ObjCProtocolDecl >.

Definition at line 1671 of file DeclObjC.h.


Member Function Documentation

static bool clang::ObjCProtocolDecl::classof ( const Decl D) [inline, static]

Reimplemented from clang::ObjCContainerDecl.

Definition at line 1690 of file DeclObjC.h.

References classofKind(), and clang::Decl::getKind().

static bool clang::ObjCProtocolDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::ObjCContainerDecl.

Definition at line 1691 of file DeclObjC.h.

Referenced by classof().

Definition at line 1617 of file DeclObjC.cpp.

References getDefinition(), and clang::NamedDecl::getIdentifier().

void ObjCProtocolDecl::collectPropertiesToImplement ( PropertyMap PM,
PropertyDeclOrder PO 
) const [override, virtual]

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.

Reimplemented from clang::ObjCContainerDecl.

Definition at line 1601 of file DeclObjC.cpp.

References getDefinition().

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

Definition at line 1544 of file DeclObjC.cpp.

References AttributeLangSupport::C, and clang::ASTContext::getLangOpts().

Retrieves the canonical declaration of this Objective-C protocol.

Reimplemented from clang::Decl.

Definition at line 1681 of file DeclObjC.h.

References clang::Redeclarable< ObjCProtocolDecl >::getFirstDecl().

Referenced by clang::ASTDeclReader::VisitObjCProtocolDecl().

Reimplemented from clang::Decl.

Definition at line 1682 of file DeclObjC.h.

References clang::Redeclarable< ObjCProtocolDecl >::getFirstDecl().

Retrieve the definition of this protocol, if any.

Definition at line 1647 of file DeclObjC.h.

References hasDefinition().

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

Definition at line 1639 of file DeclObjC.cpp.

References clang::NamedDecl::getName().

Definition at line 1557 of file DeclObjC.h.

References hasDefinition().

SourceRange clang::ObjCProtocolDecl::getSourceRange ( ) const [inline, override, virtual]

Source range that this declaration covers.

Reimplemented from clang::ObjCContainerDecl.

Definition at line 1664 of file DeclObjC.h.

References clang::ObjCContainerDecl::getAtStartLoc(), clang::Decl::getLocation(), and isThisDeclarationADefinition().

Determine whether this particular declaration is also the definition.

Definition at line 1653 of file DeclObjC.h.

References getDefinition().

Referenced by CheckProtocolMethodDefs(), clang::Sema::FindProtocolDeclaration(), getSourceRange(), clang::ASTDeclWriter::VisitObjCProtocolDecl(), and clang::ASTNodeImporter::VisitObjCProtocolDecl().

Definition at line 1620 of file DeclObjC.h.

References lookupMethod().

Definition at line 1617 of file DeclObjC.h.

References lookupMethod().

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

Definition at line 1553 of file DeclObjC.cpp.

References clang::NamedDecl::getIdentifier(), lookupProtocolNamed(), and protocols().

Referenced by lookupProtocolNamed().

Definition at line 1567 of file DeclObjC.h.

References hasDefinition().

Referenced by clang::ASTNodeImporter::ImportDefinition(), and protocols().

Definition at line 1573 of file DeclObjC.h.

References hasDefinition().

Referenced by clang::ASTNodeImporter::ImportDefinition(), and protocols().

Definition at line 1585 of file DeclObjC.h.

References hasDefinition().

Referenced by clang::ASTNodeImporter::ImportDefinition(), and protocol_locs().

Definition at line 1591 of file DeclObjC.h.

References hasDefinition().

Referenced by protocol_locs().

Definition at line 1582 of file DeclObjC.h.

References protocol_loc_begin(), and protocol_loc_end().

Referenced by clang::ASTDeclWriter::VisitObjCProtocolDecl().

Definition at line 1597 of file DeclObjC.h.

References hasDefinition().

Referenced by clang::ASTDeclWriter::VisitObjCProtocolDecl().

void clang::ObjCProtocolDecl::setProtocolList ( ObjCProtocolDecl *const *  List,
unsigned  Num,
const SourceLocation Locs,
ASTContext C 
) [inline]

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

Definition at line 1606 of file DeclObjC.h.

References hasDefinition().

Referenced by clang::Sema::ActOnStartProtocolInterface(), clang::ASTNodeImporter::ImportDefinition(), and clang::ASTDeclReader::VisitObjCProtocolDecl().

Starts the definition of this Objective-C protocol.

Definition at line 1593 of file DeclObjC.cpp.

References clang::Redeclarable< ObjCProtocolDecl >::redecls().

Referenced by clang::Sema::ActOnStartProtocolInterface(), and clang::ASTNodeImporter::ImportDefinition().


Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::Redeclarable< ObjCProtocolDecl >.

Definition at line 1694 of file DeclObjC.h.

friend class ASTDeclWriter [friend]

Reimplemented from clang::Redeclarable< ObjCProtocolDecl >.

Definition at line 1695 of file DeclObjC.h.

friend class ASTReader [friend]

Reimplemented from clang::Decl.

Definition at line 1693 of file DeclObjC.h.


The documentation for this class was generated from the following files: