class ObjCCategoryDecl

Declaration

class ObjCCategoryDecl : public ObjCContainerDecl { /* full declaration omitted */ };

Description

ObjCCategoryDecl - Represents a category declaration. A category allows you to add methods to an existing class (without subclassing or modifying the original class interface or implementation:-). Categories don't allow you to add instance data. The following example adds "myMethod" to all NSView's within a process: @ interface NSView (MyViewMethods) - myMethod; @ end Categories also allow you to split the implementation of a class across several files (a feature more naturally supported in C++). Categories were originally inspired by dynamic languages such as Common Lisp and Smalltalk. More traditional class-based languages (C++, Java) don't support this level of dynamism, which is both powerful and dangerous.

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

Inherits from: ObjCContainerDecl

Member Variables

private clang::ObjCInterfaceDecl* ClassInterface
Interface belonging to this category
private clang::ObjCTypeParamList* TypeParamList = nullptr
The type parameters associated with this category, if any.
private clang::ObjCProtocolList ReferencedProtocols
referenced protocols in this category.
private clang::ObjCCategoryDecl* NextClassCategory = nullptr
Next category belonging to this class. FIXME: this should not be a singly-linked list. Move storage elsewhere.
private clang::SourceLocation CategoryNameLoc
The location of the category name in this declaration.
private clang::SourceLocation IvarLBraceLoc
class extension may have private ivars.
private clang::SourceLocation IvarRBraceLoc

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

  • public static clang::ObjCCategoryDecl * Create(clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation AtLoc, clang::SourceLocation ClassNameLoc, clang::SourceLocation CategoryNameLoc, clang::IdentifierInfo * Id, clang::ObjCInterfaceDecl * IDecl, clang::ObjCTypeParamList * typeParamList, clang::SourceLocation IvarLBraceLoc = clang::SourceLocation(), clang::SourceLocation IvarRBraceLoc = clang::SourceLocation())
  • public static clang::ObjCCategoryDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID)
  • public bool IsClassExtension() const
  • private ObjCCategoryDecl(clang::DeclContext * DC, clang::SourceLocation AtLoc, clang::SourceLocation ClassNameLoc, clang::SourceLocation CategoryNameLoc, clang::IdentifierInfo * Id, clang::ObjCInterfaceDecl * IDecl, clang::ObjCTypeParamList * typeParamList, clang::SourceLocation IvarLBraceLoc = clang::SourceLocation(), clang::SourceLocation IvarRBraceLoc = clang::SourceLocation())
  • private void anchor()
  • public static bool classof(const clang::Decl * D)
  • public static bool classofKind(clang::Decl::Kind K)
  • public clang::SourceLocation getCategoryNameLoc() const
  • public clang::ObjCInterfaceDecl * getClassInterface()
  • public const clang::ObjCInterfaceDecl * getClassInterface() const
  • public clang::ObjCCategoryImplDecl * getImplementation() const
  • public clang::SourceLocation getIvarLBraceLoc() const
  • public clang::SourceLocation getIvarRBraceLoc() const
  • public clang::ObjCCategoryDecl * getNextClassCategory() const
  • public clang::ObjCCategoryDecl * getNextClassCategoryRaw() const
  • public const clang::ObjCProtocolList & getReferencedProtocols() const
  • public clang::ObjCTypeParamList * getTypeParamList() const
  • public clang::ObjCCategoryDecl::ivar_iterator ivar_begin() const
  • public bool ivar_empty() const
  • public clang::ObjCCategoryDecl::ivar_iterator ivar_end() const
  • public unsigned int ivar_size() const
  • public clang::ObjCCategoryDecl::ivar_range ivars() const
  • public clang::ObjCCategoryDecl::protocol_iterator protocol_begin() const
  • public clang::ObjCCategoryDecl::protocol_iterator protocol_end() const
  • public clang::ObjCCategoryDecl::protocol_loc_iterator protocol_loc_begin() const
  • public clang::ObjCCategoryDecl::protocol_loc_iterator protocol_loc_end() const
  • public clang::ObjCCategoryDecl::protocol_loc_range protocol_locs() const
  • public unsigned int protocol_size() const
  • public clang::ObjCCategoryDecl::protocol_range protocols() const
  • public void setCategoryNameLoc(clang::SourceLocation Loc)
  • public void setImplementation(clang::ObjCCategoryImplDecl * ImplD)
  • public void setIvarLBraceLoc(clang::SourceLocation Loc)
  • public void setIvarRBraceLoc(clang::SourceLocation Loc)
  • public void setProtocolList(clang::ObjCProtocolDecl *const * List, unsigned int Num, const clang::SourceLocation * Locs, clang::ASTContext & C)
  • public void setTypeParamList(clang::ObjCTypeParamList * TPL)

Inherited from ObjCContainerDecl:

Inherited from DeclContext:

Inherited from NamedDecl:

Inherited from Decl:

Methods

static clang::ObjCCategoryDecl* Create(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation AtLoc,
    clang::SourceLocation ClassNameLoc,
    clang::SourceLocation CategoryNameLoc,
    clang::IdentifierInfo* Id,
    clang::ObjCInterfaceDecl* IDecl,
    clang::ObjCTypeParamList* typeParamList,
    clang::SourceLocation IvarLBraceLoc =
        clang::SourceLocation(),
    clang::SourceLocation IvarRBraceLoc =
        clang::SourceLocation())

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

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation AtLoc
clang::SourceLocation ClassNameLoc
clang::SourceLocation CategoryNameLoc
clang::IdentifierInfo* Id
clang::ObjCInterfaceDecl* IDecl
clang::ObjCTypeParamList* typeParamList
clang::SourceLocation IvarLBraceLoc = clang::SourceLocation()
clang::SourceLocation IvarRBraceLoc = clang::SourceLocation()

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

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

Parameters

clang::ASTContext& C
unsigned int ID

bool IsClassExtension() const

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

ObjCCategoryDecl(
    clang::DeclContext* DC,
    clang::SourceLocation AtLoc,
    clang::SourceLocation ClassNameLoc,
    clang::SourceLocation CategoryNameLoc,
    clang::IdentifierInfo* Id,
    clang::ObjCInterfaceDecl* IDecl,
    clang::ObjCTypeParamList* typeParamList,
    clang::SourceLocation IvarLBraceLoc =
        clang::SourceLocation(),
    clang::SourceLocation IvarRBraceLoc =
        clang::SourceLocation())

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

Parameters

clang::DeclContext* DC
clang::SourceLocation AtLoc
clang::SourceLocation ClassNameLoc
clang::SourceLocation CategoryNameLoc
clang::IdentifierInfo* Id
clang::ObjCInterfaceDecl* IDecl
clang::ObjCTypeParamList* typeParamList
clang::SourceLocation IvarLBraceLoc = clang::SourceLocation()
clang::SourceLocation IvarRBraceLoc = clang::SourceLocation()

void anchor()

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

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

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

Parameters

const clang::Decl* D

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

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

Parameters

clang::Decl::Kind K

clang::SourceLocation getCategoryNameLoc() const

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

clang::ObjCInterfaceDecl* getClassInterface()

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

const clang::ObjCInterfaceDecl*
getClassInterface() const

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

clang::ObjCCategoryImplDecl* getImplementation()
    const

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

clang::SourceLocation getIvarLBraceLoc() const

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

clang::SourceLocation getIvarRBraceLoc() const

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

clang::ObjCCategoryDecl* getNextClassCategory()
    const

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

clang::ObjCCategoryDecl* getNextClassCategoryRaw()
    const

Description

Retrieve the pointer to the next stored category (or extension), which may be hidden.

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

const clang::ObjCProtocolList&
getReferencedProtocols() const

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

clang::ObjCTypeParamList* getTypeParamList() const

Description

Retrieve the type parameter list associated with this category or extension.

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

clang::ObjCCategoryDecl::ivar_iterator
ivar_begin() const

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

bool ivar_empty() const

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

clang::ObjCCategoryDecl::ivar_iterator ivar_end()
    const

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

unsigned int ivar_size() const

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

clang::ObjCCategoryDecl::ivar_range ivars() const

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

clang::ObjCCategoryDecl::protocol_iterator
protocol_begin() const

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

clang::ObjCCategoryDecl::protocol_iterator
protocol_end() const

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

clang::ObjCCategoryDecl::protocol_loc_iterator
protocol_loc_begin() const

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

clang::ObjCCategoryDecl::protocol_loc_iterator
protocol_loc_end() const

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

clang::ObjCCategoryDecl::protocol_loc_range
protocol_locs() const

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

unsigned int protocol_size() const

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

clang::ObjCCategoryDecl::protocol_range
protocols() const

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

void setCategoryNameLoc(clang::SourceLocation Loc)

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

Parameters

clang::SourceLocation Loc

void setImplementation(
    clang::ObjCCategoryImplDecl* ImplD)

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

Parameters

clang::ObjCCategoryImplDecl* ImplD

void setIvarLBraceLoc(clang::SourceLocation Loc)

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

Parameters

clang::SourceLocation Loc

void setIvarRBraceLoc(clang::SourceLocation Loc)

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

Parameters

clang::SourceLocation Loc

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

Parameters

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

void setTypeParamList(
    clang::ObjCTypeParamList* TPL)

Description

Set the type parameters of this category. This function is used by the AST importer, which must import the type parameters after creating their DeclContext to avoid loops.

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

Parameters

clang::ObjCTypeParamList* TPL