clang API Documentation
Represents an Objective-C protocol declaration. More...
#include <DeclObjC.h>
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.
Definition at line 1561 of file DeclObjC.h.
Definition at line 1579 of file DeclObjC.h.
typedef llvm::iterator_range<protocol_loc_iterator> clang::ObjCProtocolDecl::protocol_loc_range |
Definition at line 1580 of file DeclObjC.h.
typedef llvm::iterator_range<protocol_iterator> clang::ObjCProtocolDecl::protocol_range |
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.
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().
void ObjCProtocolDecl::collectInheritedProtocolProperties | ( | const ObjCPropertyDecl * | Property, |
ProtocolPropertyMap & | PM | ||
) | const |
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 1533 of file DeclObjC.cpp.
References AttributeLangSupport::C, and clang::ASTContext::getLangOpts().
Referenced by clang::Sema::ActOnForwardProtocolDeclaration(), clang::Sema::ActOnStartProtocolInterface(), and clang::ASTNodeImporter::VisitObjCProtocolDecl().
ObjCProtocolDecl * ObjCProtocolDecl::CreateDeserialized | ( | ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Definition at line 1544 of file DeclObjC.cpp.
References AttributeLangSupport::C, and clang::ASTContext::getLangOpts().
ObjCProtocolDecl* clang::ObjCProtocolDecl::getCanonicalDecl | ( | ) | [inline, override, virtual] |
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().
const ObjCProtocolDecl* clang::ObjCProtocolDecl::getCanonicalDecl | ( | ) | const [inline] |
Reimplemented from clang::Decl.
Definition at line 1682 of file DeclObjC.h.
References clang::Redeclarable< ObjCProtocolDecl >::getFirstDecl().
ObjCProtocolDecl* clang::ObjCProtocolDecl::getDefinition | ( | ) | [inline] |
Retrieve the definition of this protocol, if any.
Definition at line 1642 of file DeclObjC.h.
References hasDefinition().
Referenced by clang::Sema::ActOnStartProtocolInterface(), CheckProtocolMethodDefs(), ClassImplementsAllMethodsAndProperties(), collectInheritedProtocolProperties(), collectPropertiesToImplement(), DiagnosePropertyMismatchDeclInProtocols(), clang::ObjCPropertyDecl::findPropertyDecl(), clang::ObjCContainerDecl::FindPropertyDeclaration(), clang::Sema::FindProtocolDeclaration(), clang::serialization::getDefinitiveDeclContext(), clang::ObjCContainerDecl::getMethod(), clang::DeclContext::getPrimaryContext(), clang::ASTImporter::ImportContext(), clang::ASTNodeImporter::ImportDefinition(), isThisDeclarationADefinition(), lookupMethod(), NestedProtocolHasNoDefinition(), clang::Sema::ParseObjCProtocolExpression(), and clang::ASTNodeImporter::VisitObjCProtocolDecl().
const ObjCProtocolDecl* clang::ObjCProtocolDecl::getDefinition | ( | ) | const [inline] |
Retrieve the definition of this protocol, if any.
Definition at line 1647 of file DeclObjC.h.
References hasDefinition().
StringRef ObjCProtocolDecl::getObjCRuntimeNameAsString | ( | ) | const |
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().
const ObjCProtocolList& clang::ObjCProtocolDecl::getReferencedProtocols | ( | ) | const [inline] |
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().
bool clang::ObjCProtocolDecl::hasDefinition | ( | ) | const [inline] |
Determine whether this protocol has a definition.
Definition at line 1625 of file DeclObjC.h.
References clang::NamedDecl::getIdentifier(), and clang::Decl::updateOutOfDate().
Referenced by clang::Sema::CheckSingleAssignmentConstraints(), getDefinition(), getReferencedProtocols(), NestedProtocolHasNoDefinition(), clang::Sema::ParseObjCProtocolExpression(), protocol_begin(), protocol_end(), protocol_loc_begin(), protocol_loc_end(), protocol_size(), and setProtocolList().
bool clang::ObjCProtocolDecl::isThisDeclarationADefinition | ( | ) | const [inline] |
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().
ObjCMethodDecl* clang::ObjCProtocolDecl::lookupClassMethod | ( | Selector | Sel | ) | const [inline] |
Definition at line 1620 of file DeclObjC.h.
References lookupMethod().
ObjCMethodDecl* clang::ObjCProtocolDecl::lookupInstanceMethod | ( | Selector | Sel | ) | const [inline] |
Definition at line 1617 of file DeclObjC.h.
References lookupMethod().
ObjCMethodDecl * ObjCProtocolDecl::lookupMethod | ( | Selector | Sel, |
bool | isInstance | ||
) | const |
Definition at line 1568 of file DeclObjC.cpp.
References getDefinition(), clang::ObjCContainerDecl::getMethod(), clang::NamedDecl::isHidden(), and protocols().
Referenced by lookupClassMethod(), and lookupInstanceMethod().
Definition at line 1553 of file DeclObjC.cpp.
References clang::NamedDecl::getIdentifier(), lookupProtocolNamed(), and protocols().
Referenced by lookupProtocolNamed().
protocol_iterator clang::ObjCProtocolDecl::protocol_begin | ( | ) | const [inline] |
Definition at line 1567 of file DeclObjC.h.
References hasDefinition().
Referenced by clang::ASTNodeImporter::ImportDefinition(), and protocols().
protocol_iterator clang::ObjCProtocolDecl::protocol_end | ( | ) | const [inline] |
Definition at line 1573 of file DeclObjC.h.
References hasDefinition().
Referenced by clang::ASTNodeImporter::ImportDefinition(), and protocols().
protocol_loc_iterator clang::ObjCProtocolDecl::protocol_loc_begin | ( | ) | const [inline] |
Definition at line 1585 of file DeclObjC.h.
References hasDefinition().
Referenced by clang::ASTNodeImporter::ImportDefinition(), and protocol_locs().
protocol_loc_iterator clang::ObjCProtocolDecl::protocol_loc_end | ( | ) | const [inline] |
Definition at line 1591 of file DeclObjC.h.
References hasDefinition().
Referenced by protocol_locs().
protocol_loc_range clang::ObjCProtocolDecl::protocol_locs | ( | ) | const [inline] |
Definition at line 1582 of file DeclObjC.h.
References protocol_loc_begin(), and protocol_loc_end().
Referenced by clang::ASTDeclWriter::VisitObjCProtocolDecl().
unsigned clang::ObjCProtocolDecl::protocol_size | ( | ) | const [inline] |
Definition at line 1597 of file DeclObjC.h.
References hasDefinition().
Referenced by clang::ASTDeclWriter::VisitObjCProtocolDecl().
protocol_range clang::ObjCProtocolDecl::protocols | ( | ) | const [inline] |
Definition at line 1564 of file DeclObjC.h.
References protocol_begin(), and protocol_end().
Referenced by clang::Sema::ActOnProperty(), CheckPropertyAgainstProtocol(), CheckProtocolMethodDefs(), FindGetterSetterNameDeclFromProtocolList(), clang::ObjCContainerDecl::FindPropertyDeclaration(), findProtocolsWithExplicitImpls(), lookupMethod(), lookupProtocolNamed(), NestedProtocolHasNoDefinition(), clang::ASTContext::ProtocolCompatibleWithProtocol(), and 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().
void ObjCProtocolDecl::startDefinition | ( | ) |
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().
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.