clang API Documentation
Smart pointer class that efficiently represents Objective-C method names. More...
#include <IdentifierTable.h>
Public Member Functions | |
Selector () | |
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 |
unsigned | getNumArgs () 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. "foo:bar:") and return it as an std::string. | |
void | print (llvm::raw_ostream &OS) const |
Prints the full selector name (e.g. "foo:bar:"). | |
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 605 of file IdentifierTable.h.
clang::Selector::Selector | ( | ) | [inline] |
The default ctor should only be used when creating data structures that will contain selectors.
Definition at line 652 of file IdentifierTable.h.
Referenced by getEmptyMarker(), and getTombstoneMarker().
clang::Selector::Selector | ( | uintptr_t | V | ) | [inline] |
Definition at line 653 of file IdentifierTable.h.
void* clang::Selector::getAsOpaquePtr | ( | ) | const [inline] |
Definition at line 662 of file IdentifierTable.h.
Referenced by llvm::PointerLikeTypeTraits< clang::Selector >::getAsVoidPointer(), llvm::DenseMapInfo< clang::Selector >::getHashValue(), clang::serialization::reader::ASTDeclContextNameLookupTrait::GetInternalKey(), clang::ASTWriter::getSelectorRef(), and clang::ObjCMessageExpr::setSelector().
std::string Selector::getAsString | ( | ) | const |
Derive the full selector name (e.g. "foo:bar:") and return it as an std::string.
Definition at line 394 of file IdentifierTable.cpp.
References clang::IdentifierInfo::getName(), clang::MultiKeywordSelector::getName(), and getNumArgs().
Referenced by clang::Sema::CheckMessageArgumentTypes(), clang::Sema::CheckObjCBridgeRelatedConversions(), clang::ASTContext::getObjCEncodingForPropertyDecl(), HelperSelectorsForTypoCorrection(), clang::Sema::ParseObjCSelectorExpression(), print(), clang::Sema::SelectorsForTypoCorrection(), and SymbolNameForMethod().
static Selector clang::Selector::getEmptyMarker | ( | ) | [inline, static] |
Definition at line 720 of file IdentifierTable.h.
References Selector().
Referenced by llvm::DenseMapInfo< clang::Selector >::getEmptyKey().
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.
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. |
Definition at line 367 of file IdentifierTable.cpp.
References clang::MultiKeywordSelector::getIdentifierInfoForSlot().
Referenced by clang::ObjCMethodCall::argumentsMayEscape(), clang::serialization::ComputeHash(), clang::CodeCompletionResult::CreateCodeCompletionString(), GetAssumedMessageSendExprType(), getInstTypeMethodFamily(), getNameForSlot(), getOrderedName(), getStandardSelLoc(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), and clang::CodeGen::CodeGenFunction::StartObjCMethod().
ObjCInstanceTypeFamily Selector::getInstTypeMethodFamily | ( | Selector | sel | ) | [static] |
Definition at line 474 of file IdentifierTable.cpp.
References getIdentifierInfoForSlot(), clang::IdentifierInfo::getName(), clang::OIT_Array, clang::OIT_Dictionary, clang::OIT_Init, clang::OIT_None, clang::OIT_ReturnsSelf, clang::OIT_Singleton, and startsWithWord().
ObjCMethodFamily clang::Selector::getMethodFamily | ( | ) | const [inline] |
Derive the conventional family of this method.
Definition at line 712 of file IdentifierTable.h.
Referenced by clang::Sema::ActOnMethodDeclaration(), clang::Sema::BuildInstanceMessage(), clang::ObjCMethodDecl::getMethodFamily(), clang::ObjCMessageExpr::getMethodFamily(), and clang::Sema::ParseObjCSelectorExpression().
StringRef Selector::getNameForSlot | ( | unsigned | argIndex | ) | const |
Retrieve the name at a given position in the selector.
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. |
Definition at line 377 of file IdentifierTable.cpp.
References getIdentifierInfoForSlot(), and clang::IdentifierInfo::getName().
Referenced by AddSuperSendCompletion(), checkObjCPointerIntrospection(), clang::Sema::CodeCompleteObjCMethodDecl(), clang::Sema::CodeCompleteObjCSelector(), clang::DeclarationName::compare(), clang::CodeCompletionResult::CreateCodeCompletionString(), clang::Sema::DiagnoseAssignmentAsCondition(), findCapturingExpr(), getFreeWhenDoneArg(), hasDefaultGetterName(), hasDefaultSetterName(), isAcceptableMethodMismatch(), isKnownDeallocObjCMethodName(), isSetterLikeSelector(), and rewriteToObjCProperty().
unsigned Selector::getNumArgs | ( | ) | const |
Definition at line 356 of file IdentifierTable.cpp.
References clang::MultiKeywordSelector::getNumArgs().
Referenced by clang::Sema::ActOnMethodDeclaration(), AddSuperSendCompletion(), clang::ObjCMethodCall::argumentsMayEscape(), clang::Sema::CheckMessageArgumentTypes(), clang::Sema::CodeCompleteObjCMethodDecl(), clang::Sema::CodeCompleteObjCSelector(), clang::DeclarationName::compare(), clang::serialization::ComputeHash(), DiagnoseARCUseOfWeakReceiver(), clang::ObjCMethodDecl::findPropertyDecl(), getAsString(), getFreeWhenDoneArg(), clang::ObjCSelectorExpr::getNumArgs(), clang::ObjCMethodDecl::getNumSelectorLocs(), clang::ObjCMessageExpr::getNumSelectorLocs(), getStandardSelLoc(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), isSetterLikeSelector(), clang::ObjCMethodDecl::sel_param_end(), and clang::Sema::SelectorsForTypoCorrection().
ObjCStringFormatFamily clang::Selector::getStringFormatFamily | ( | ) | const [inline] |
Definition at line 716 of file IdentifierTable.h.
Referenced by DiagnoseCStringFormatDirectiveInObjCAPI().
static Selector clang::Selector::getTombstoneMarker | ( | ) | [inline, static] |
Definition at line 723 of file IdentifierTable.h.
References Selector().
Referenced by llvm::DenseMapInfo< clang::Selector >::getTombstoneKey().
bool clang::Selector::isKeywordSelector | ( | ) | const [inline] |
Definition at line 670 of file IdentifierTable.h.
bool clang::Selector::isNull | ( | ) | const [inline] |
Determine whether this is the empty selector.
Definition at line 667 of file IdentifierTable.h.
Referenced by clang::Sema::ActOnInstanceMessage(), AddClassMessageCompletions(), clang::Sema::CodeCompleteObjCInstanceMessage(), clang::Sema::CodeCompleteObjCMethodDeclSelector(), clang::Sema::CodeCompleteObjCSelector(), GetAssumedMessageSendExprType(), clang::MultiplexExternalSemaSource::GetExternalSelector(), clang::ASTImporter::Import(), clang::ento::lazyInitKeywordSelector(), and clang::ento::lazyInitNullarySelector().
bool clang::Selector::isUnarySelector | ( | ) | const [inline] |
Definition at line 673 of file IdentifierTable.h.
Referenced by AddSuperSendCompletion(), clang::Sema::BuildInstanceMessage(), clang::Sema::CheckMessageArgumentTypes(), clang::Sema::CodeCompleteObjCSelector(), clang::CodeCompletionResult::CreateCodeCompletionString(), clang::Sema::DiagnoseAssignmentAsCondition(), findCapturingExpr(), clang::ObjCMethodDecl::getNumSelectorLocs(), clang::ObjCMessageExpr::getNumSelectorLocs(), isAcceptableMethodMismatch(), isAcceptableObjCSelector(), isSetterLikeSelector(), and clang::CodeGen::CodeGenFunction::StartObjCMethod().
Definition at line 659 of file IdentifierTable.h.
operator==/!= - Indicate whether the specified selectors are identical.
Definition at line 656 of file IdentifierTable.h.
void Selector::print | ( | llvm::raw_ostream & | OS | ) | const |
Prints the full selector name (e.g. "foo:bar:").
Definition at line 415 of file IdentifierTable.cpp.
References getAsString().
Referenced by CompareReturnTypes(), and clang::MangleContext::mangleObjCMethodName().
friend class DeclarationName [friend] |
Definition at line 648 of file IdentifierTable.h.
friend class Diagnostic [friend] |
Definition at line 606 of file IdentifierTable.h.
friend class SelectorTable [friend] |
Definition at line 647 of file IdentifierTable.h.