clang: clang::Selector Class Reference (original) (raw)

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

#include "[clang/Basic/IdentifierTable.h](IdentifierTable%5F8h%5Fsource.html)"

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 IdentifierInfo * getIdentifierInfoForSlot (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

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 966 of file IdentifierTable.h.

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

dump()

LLVM_DUMP_METHOD void Selector::dump ( ) const

getAsOpaquePtr()

void * clang::Selector::getAsOpaquePtr ( ) const inline

getAsString()

std::string Selector::getAsString ( ) const

Derive the full selector name (e.g.

"foo:bar:") and return it as an std::string.

Definition at line 581 of file IdentifierTable.cpp.

References clang::IdentifierInfo::getName(), clang::MultiKeywordSelector::getName(), getNumArgs(), and isNull().

Referenced by clang::SemaObjC::ActOnMethodDeclaration(), clang::ast_matchers::AST_MATCHER_P(), clang::SemaObjC::CheckMessageArgumentTypes(), clang::ASTContext::getObjCEncodingForPropertyDecl(), HelperSelectorsForTypoCorrection(), clang::SemaObjC::ParseObjCSelectorExpression(), print(), and clang::SemaObjC::SelectorsForTypoCorrection().

getEmptyMarker()

static Selector clang::Selector::getEmptyMarker ( ) inlinestatic

getIdentifierInfoForSlot()

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()](classclang%5F1%5F1Selector.html#a1e7674118587ab893c3676b7aa980263 "Retrieve the name at a given position in the selector."), which returns an empty string when the identifier pointer would be NULL.

Parameters

argIndex The 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 553 of file IdentifierTable.cpp.

References clang::MultiKeywordSelector::getIdentifierInfoForSlot().

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

getInstTypeMethodFamily()

getMethodFamily()

getNameForSlot()

StringRef Selector::getNameForSlot ( unsigned argIndex ) const

Retrieve the name at a given position in the selector.

Parameters

argIndex The index for which we want to retrieve the name. This index shall be less than 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.

Definition at line 564 of file IdentifierTable.cpp.

References getIdentifierInfoForSlot(), and clang::IdentifierInfo::getName().

Referenced by AddSuperSendCompletion(), clang::SemaCodeCompletion::CodeCompleteObjCMethodDecl(), clang::SemaCodeCompletion::CodeCompleteObjCSelector(), clang::DeclarationName::compare(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), clang::Sema::DiagnoseAssignmentAsCondition(), DoEmitAvailabilityWarning(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCMethod(), clang::SelectorTable::getPropertyNameFromSetterSelector(), hasDefaultGetterName(), hasDefaultSetterName(), isAcceptableMethodMismatch(), isKeywordSelector(), clang::isSetterLikeSelector(), isUnarySelector(), clang::Sema::ProcessAPINotes(), rewriteToObjCProperty(), tryEmitSpecializedAllocInit(), and tryGenerateSpecializedMessageSend().

getNumArgs()

Definition at line 541 of file IdentifierTable.cpp.

References clang::detail::DeclarationNameExtra::getNumArgs().

Referenced by clang::SemaObjC::ActOnMethodDeclaration(), AddSuperSendCompletion(), clang::ento::ObjCMethodCall::argumentsMayEscape(), clang::SemaObjC::CheckMessageArgumentTypes(), clang::SemaCodeCompletion::CodeCompleteObjCMethodDecl(), clang::SemaCodeCompletion::CodeCompleteObjCSelector(), clang::DeclarationName::compare(), clang::serialization::ComputeHash(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), DoEmitAvailabilityWarning(), clang::ObjCMethodDecl::findPropertyDecl(), getAsString(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCMethod(), clang::ObjCSelectorExpr::getNumArgs(), clang::ObjCMethodDecl::getNumSelectorLocs(), clang::ObjCMessageExpr::getNumSelectorLocs(), getStandardSelLoc(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), isKeywordSelector(), clang::isSetterLikeSelector(), IsStructurallyEquivalent(), clang::Sema::ProcessAPINotes(), clang::ObjCMethodDecl::sel_param_end(), clang::Sema::SelectBestMethod(), clang::SemaObjC::SelectorsForTypoCorrection(), and tryGenerateSpecializedMessageSend().

getStringFormatFamily()

getTombstoneMarker()

static Selector clang::Selector::getTombstoneMarker ( ) inlinestatic

isKeywordSelector() [1/2]

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

isKeywordSelector() [2/2]

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

isNull()

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

isUnarySelector() [1/2]

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

Definition at line 1056 of file IdentifierTable.h.

Referenced by AddSuperSendCompletion(), clang::SemaObjC::BuildInstanceMessage(), clang::SemaObjC::CheckMessageArgumentTypes(), clang::SemaCodeCompletion::CodeCompleteObjCMethodDecl(), clang::SemaCodeCompletion::CodeCompleteObjCSelector(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), clang::Sema::DiagnoseAssignmentAsCondition(), clang::ObjCMethodDecl::getNumSelectorLocs(), clang::ObjCMessageExpr::getNumSelectorLocs(), isAcceptableMethodMismatch(), isAcceptableObjCSelector(), clang::isSetterLikeSelector(), isUnarySelector(), clang::Sema::ProcessAPINotes(), tryEmitSpecializedAllocInit(), and tryGenerateSpecializedMessageSend().

isUnarySelector() [2/2]

bool Selector::isUnarySelector ( StringRef Name ) const

operator!=()

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

operator==()

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

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

Definition at line 1041 of file IdentifierTable.h.

print()

void Selector::print ( llvm::raw_ostream & OS ) const

DeclarationName

Diagnostic

SelectorTable


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