class Selector

Declaration

class Selector { /* full declaration omitted */ };

Description

Smart pointer class that efficiently represents Objective-C method names. This class will either point to an IdentifierInfo or a MultiKeywordSelector (which is private). This enables us to optimize selectors that take no arguments and selectors that take 1 argument, which accounts for 78% of all selectors in Cocoa.h.

Declared at: clang/include/clang/Basic/IdentifierTable.h:752

Member Variables

private uintptr_t InfoPtr = 0
A pointer to the MultiKeywordSelector or IdentifierInfo. We use the low three bits of InfoPtr to store an IdentifierInfoFlag. Note that in any case IdentifierInfo and MultiKeywordSelector are already aligned to 8 bytes even on 32 bits archs because of DeclarationName.

Method Overview

Methods

Selector(clang::MultiKeywordSelector* SI)

Declared at: clang/include/clang/Basic/IdentifierTable.h:779

Parameters

clang::MultiKeywordSelector* SI

Selector(clang::IdentifierInfo* II,
         unsigned int nArgs)

Declared at: clang/include/clang/Basic/IdentifierTable.h:772

Parameters

clang::IdentifierInfo* II
unsigned int nArgs

Selector()

Description

The default ctor should only be used when creating data structures that will contain selectors.

Declared at: clang/include/clang/Basic/IdentifierTable.h:806

Selector(uintptr_t V)

Declared at: clang/include/clang/Basic/IdentifierTable.h:807

Parameters

uintptr_t V

void dump() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:873

clang::IdentifierInfo* getAsIdentifierInfo() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:785

void* getAsOpaquePtr() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:817

std::string getAsString() const

Description

Derive the full selector name (e.g. "foo:bar:") and return it as an std::string.

Declared at: clang/include/clang/Basic/IdentifierTable.h:868

static clang::Selector getEmptyMarker()

Declared at: clang/include/clang/Basic/IdentifierTable.h:884

unsigned int getIdentifierInfoFlag() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:795

clang::IdentifierInfo* getIdentifierInfoForSlot(
    unsigned int argIndex) const

Description

Retrieve the identifier at a given position in the selector. Note that the identifier pointer returned may be NULL. Clients that only care about the text of the identifier string, and not the specific, uniqued identifier pointer, should use \c getNameForSlot(), which returns an empty string when the identifier pointer would be NULL.

Declared at: clang/include/clang/Basic/IdentifierTable.h:854

Parameters

unsigned int argIndex
The index for which we want to retrieve the identifier. This index shall be less than \c getNumArgs() unless this is a keyword selector, in which case 0 is the only permissible value.

Returns

the uniqued identifier for this slot, or NULL if this slot has no corresponding identifier.

static clang::ObjCInstanceTypeFamily
getInstTypeMethodFamily(clang::Selector sel)

Declared at: clang/include/clang/Basic/IdentifierTable.h:892

Parameters

clang::Selector sel

clang::ObjCMethodFamily getMethodFamily() const

Description

Derive the conventional family of this method.

Declared at: clang/include/clang/Basic/IdentifierTable.h:876

static clang::ObjCMethodFamily
getMethodFamilyImpl(clang::Selector sel)

Declared at: clang/include/clang/Basic/IdentifierTable.h:799

Parameters

clang::Selector sel

clang::MultiKeywordSelector*
getMultiKeywordSelector() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:791

llvm::StringRef getNameForSlot(
    unsigned int argIndex) const

Description

Retrieve the name at a given position in the selector.

Declared at: clang/include/clang/Basic/IdentifierTable.h:864

Parameters

unsigned int argIndex
The index for which we want to retrieve the name. This index shall be less than \c getNumArgs() unless this is a keyword selector, in which case 0 is the only permissible value.

Returns

the name for this slot, which may be the empty string if no name was supplied.

unsigned int getNumArgs() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:839

clang::ObjCStringFormatFamily
getStringFormatFamily() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:880

static clang::ObjCStringFormatFamily
getStringFormatFamilyImpl(clang::Selector sel)

Declared at: clang/include/clang/Basic/IdentifierTable.h:801

Parameters

clang::Selector sel

static clang::Selector getTombstoneMarker()

Declared at: clang/include/clang/Basic/IdentifierTable.h:888

bool isKeywordSelector(
    ArrayRef<llvm::StringRef> Names) const

Description

If this selector is the specific keyword selector described by Names.

Declared at: clang/include/clang/Basic/IdentifierTable.h:834

Parameters

ArrayRef<llvm::StringRef> Names

bool isKeywordSelector() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:825

bool isNull() const

Description

Determine whether this is the empty selector.

Declared at: clang/include/clang/Basic/IdentifierTable.h:822

bool isUnarySelector() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:829

bool isUnarySelector(llvm::StringRef Name) const

Description

If this selector is the specific unary selector described by Name.

Declared at: clang/include/clang/Basic/IdentifierTable.h:837

Parameters

llvm::StringRef Name

void print(llvm::raw_ostream& OS) const

Description

Prints the full selector name (e.g. "foo:bar:").

Declared at: clang/include/clang/Basic/IdentifierTable.h:871

Parameters

llvm::raw_ostream& OS