clang 22.0.0git
clang::Selector Class Reference

Smart pointer class that efficiently represents Objective-C method names. More...

#include "clang/Basic/IdentifierTable.h"

Public Member Functions

 Selector ()=default
 The default ctor should only be used when creating data structures that will contain selectors.
 Selector (uintptr_t V)
bool operator== (Selector RHS) const
 operator==/!= - Indicate whether the specified selectors are identical.
bool operator!= (Selector RHS) const
void * getAsOpaquePtr () const
bool isNull () const
 Determine whether this is the empty selector.
bool isKeywordSelector () const
bool isUnarySelector () const
bool isKeywordSelector (ArrayRef< StringRef > Names) const
 If this selector is the specific keyword selector described by Names.
bool isUnarySelector (StringRef Name) const
 If this selector is the specific unary selector described by Name.
unsigned getNumArgs () const
const IdentifierInfogetIdentifierInfoForSlot (unsigned argIndex) const
 Retrieve the identifier at a given position in the selector.
StringRef getNameForSlot (unsigned argIndex) const
 Retrieve the name at a given position in the selector.
std::string getAsString () const
 Derive the full selector name (e.g.
void print (llvm::raw_ostream &OS) const
 Prints the full selector name (e.g. "foo:bar:").
void dump () const
ObjCMethodFamily getMethodFamily () const
 Derive the conventional family of this method.
ObjCStringFormatFamily getStringFormatFamily () const

Static Public Member Functions

static Selector getEmptyMarker ()
static Selector getTombstoneMarker ()
static ObjCInstanceTypeFamily getInstTypeMethodFamily (Selector sel)

Friends

class Diagnostic
class SelectorTable
class DeclarationName

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

Definition at line 974 of file IdentifierTable.h.

Constructor & Destructor Documentation

◆ Selector() [1/2]

clang::Selector::Selector ( )
default

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

◆ Selector() [2/2]

clang::Selector::Selector ( uintptr_t V)
inlineexplicit

Definition at line 1044 of file IdentifierTable.h.

References V.

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void Selector::dump ( ) const

Definition at line 631 of file IdentifierTable.cpp.

References print().

◆ getAsOpaquePtr()

◆ getAsString()

◆ getEmptyMarker()

Selector clang::Selector::getEmptyMarker ( )
inlinestatic

◆ getIdentifierInfoForSlot()

const IdentifierInfo * Selector::getIdentifierInfoForSlot ( unsigned argIndex) const

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 getNameForSlot(), which returns an empty string when the identifier pointer would be NULL.

Parameters
argIndexThe index for which we want to retrieve the identifier. This index shall be less than 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.

Definition at line 576 of file IdentifierTable.cpp.

References clang::MultiKeywordSelector::getIdentifierInfoForSlot().

Referenced by clang::ento::ObjCMethodCall::argumentsMayEscape(), clang::serialization::ComputeHash(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), GetAssumedMessageSendExprType(), getInstTypeMethodFamily(), getNameForSlot(), clang::CodeCompletionResult::getOrderedName(), getStandardSelLoc(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), IsStructurallyEquivalent(), and clang::CodeGen::CodeGenFunction::StartObjCMethod().

◆ getInstTypeMethodFamily()

◆ getMethodFamily()

◆ getNameForSlot()

◆ getNumArgs()

◆ getStringFormatFamily()

ObjCStringFormatFamily clang::Selector::getStringFormatFamily ( ) const
inline

Definition at line 1113 of file IdentifierTable.h.

Referenced by DiagnoseCStringFormatDirectiveInObjCAPI().

◆ getTombstoneMarker()

Selector clang::Selector::getTombstoneMarker ( )
inlinestatic

◆ isKeywordSelector() [1/2]

bool clang::Selector::isKeywordSelector ( ) const
inline

Definition at line 1062 of file IdentifierTable.h.

Referenced by tryGenerateSpecializedMessageSend().

◆ isKeywordSelector() [2/2]

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

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

Definition at line 549 of file IdentifierTable.cpp.

References getNameForSlot(), and getNumArgs().

◆ isNull()

◆ isUnarySelector() [1/2]

◆ isUnarySelector() [2/2]

bool Selector::isUnarySelector ( StringRef Name) const

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

Definition at line 560 of file IdentifierTable.cpp.

References getNameForSlot(), and isUnarySelector().

◆ operator!=()

bool clang::Selector::operator!= ( Selector RHS) const
inline

Definition at line 1052 of file IdentifierTable.h.

◆ operator==()

bool clang::Selector::operator== ( Selector RHS) const
inline

operator==/!= - Indicate whether the specified selectors are identical.

Definition at line 1049 of file IdentifierTable.h.

◆ print()

◆ DeclarationName

friend class DeclarationName
friend

Definition at line 977 of file IdentifierTable.h.

References DeclarationName.

Referenced by DeclarationName.

◆ Diagnostic

friend class Diagnostic
friend

Definition at line 975 of file IdentifierTable.h.

References Diagnostic.

Referenced by Diagnostic.

◆ SelectorTable

friend class SelectorTable
friend

Definition at line 976 of file IdentifierTable.h.

References SelectorTable.

Referenced by SelectorTable.


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