|
clang 23.0.0git
|
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 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 1045 of file IdentifierTable.h.
|
default |
The default ctor should only be used when creating data structures that will contain selectors.
|
inlineexplicit |
Definition at line 1115 of file IdentifierTable.h.
References V.
| LLVM_DUMP_METHOD void Selector::dump | ( | ) | const |
Definition at line 595 of file IdentifierTable.cpp.
References print().
|
inline |
Definition at line 1127 of file IdentifierTable.h.
Referenced by clang::serialization::DeclarationNameKey::DeclarationNameKey(), llvm::PointerLikeTypeTraits< clang::Selector >::getAsVoidPointer(), llvm::DenseMapInfo< clang::Selector >::getHashValue(), 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 568 of file IdentifierTable.cpp.
References clang::IdentifierInfo::getName(), getNumArgs(), and isNull().
Referenced by clang::SemaObjC::ActOnMethodDeclaration(), clang::ast_matchers::AST_MATCHER_P(), clang::SemaObjC::CheckMessageArgumentTypes(), clang::ASTContext::getObjCEncodingForPropertyDecl(), clang::SemaObjC::ParseObjCSelectorExpression(), print(), and clang::SemaObjC::SelectorsForTypoCorrection().
|
inlinestatic |
Definition at line 1188 of file IdentifierTable.h.
Referenced by llvm::DenseMapInfo< clang::Selector >::getEmptyKey().
| 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.
| 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 540 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().
|
static |
Definition at line 653 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().
|
inline |
Derive the conventional family of this method.
Definition at line 1180 of file IdentifierTable.h.
Referenced by clang::SemaObjC::ActOnMethodDeclaration(), clang::SemaObjC::BuildInstanceMessage(), clang::ObjCMessageExpr::getMethodFamily(), clang::ObjCMethodDecl::getMethodFamily(), clang::SemaObjC::ParseObjCSelectorExpression(), and tryGenerateSpecializedMessageSend().
| 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 551 of file IdentifierTable.cpp.
References getIdentifierInfoForSlot(), and clang::IdentifierInfo::getName().
Referenced by AddSuperSendCompletion(), checkObjCPointerIntrospection(), clang::SemaCodeCompletion::CodeCompleteObjCMethodDecl(), clang::SemaCodeCompletion::CodeCompleteObjCSelector(), clang::DeclarationName::compare(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), clang::Sema::DiagnoseAssignmentAsCondition(), DoEmitAvailabilityWarning(), clang::findCapturingExpr(), clang::extractapi::DeclarationFragmentsBuilder::getFragmentsForObjCMethod(), getFreeWhenDoneArg(), clang::SelectorTable::getPropertyNameFromSetterSelector(), hasDefaultGetterName(), hasDefaultSetterName(), isAcceptableMethodMismatch(), clang::isAllocInit(), isKeywordSelector(), clang::isSetterLikeSelector(), isUnarySelector(), isUnitTest(), clang::Sema::ProcessAPINotes(), tryEmitSpecializedAllocInit(), tryGenerateSpecializedMessageSend(), and clang::tryToFindPtrOrigin().
| unsigned Selector::getNumArgs | ( | ) | const |
Definition at line 528 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(), getFreeWhenDoneArg(), clang::ObjCMessageExpr::getNumSelectorLocs(), clang::ObjCMethodDecl::getNumSelectorLocs(), getStandardSelLoc(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), isKeywordSelector(), clang::isSetterLikeSelector(), IsStructurallyEquivalent(), clang::Sema::ProcessAPINotes(), clang::ObjCMethodDecl::sel_param_end(), clang::Sema::SelectBestMethod(), clang::SemaObjC::SelectorsForTypoCorrection(), tryGenerateSpecializedMessageSend(), and clang::tryToFindPtrOrigin().
|
inline |
Definition at line 1184 of file IdentifierTable.h.
Referenced by DiagnoseCStringFormatDirectiveInObjCAPI().
|
inlinestatic |
Definition at line 1192 of file IdentifierTable.h.
Referenced by llvm::DenseMapInfo< clang::Selector >::getTombstoneKey().
|
inline |
Definition at line 1133 of file IdentifierTable.h.
Referenced by tryGenerateSpecializedMessageSend().
If this selector is the specific keyword selector described by Names.
Definition at line 513 of file IdentifierTable.cpp.
References getNameForSlot(), and getNumArgs().
|
inline |
Determine whether this is the empty selector.
Definition at line 1130 of file IdentifierTable.h.
Referenced by AddClassMessageCompletions(), clang::SemaCodeCompletion::CodeCompleteObjCInstanceMessage(), clang::SemaCodeCompletion::CodeCompleteObjCMethodDeclSelector(), clang::SemaCodeCompletion::CodeCompleteObjCSelector(), getAsString(), GetAssumedMessageSendExprType(), clang::MultiplexExternalSemaSource::GetExternalSelector(), clang::ASTImporter::Import(), and clang::lazyInitKeywordSelector().
|
inline |
Definition at line 1135 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::findCapturingExpr(), clang::ObjCMessageExpr::getNumSelectorLocs(), clang::ObjCMethodDecl::getNumSelectorLocs(), isAcceptableMethodMismatch(), isAcceptableObjCSelector(), clang::isSetterLikeSelector(), isUnarySelector(), clang::Sema::ProcessAPINotes(), clang::CodeGen::CodeGenFunction::StartObjCMethod(), tryEmitSpecializedAllocInit(), and tryGenerateSpecializedMessageSend().
| bool Selector::isUnarySelector | ( | StringRef | Name | ) | const |
If this selector is the specific unary selector described by Name.
Definition at line 524 of file IdentifierTable.cpp.
References getNameForSlot(), and isUnarySelector().
Definition at line 1123 of file IdentifierTable.h.
operator==/!= - Indicate whether the specified selectors are identical.
Definition at line 1120 of file IdentifierTable.h.
| void Selector::print | ( | llvm::raw_ostream & | OS | ) | const |
Prints the full selector name (e.g. "foo:bar:").
Definition at line 591 of file IdentifierTable.cpp.
References getAsString().
Referenced by CompareReturnTypes(), dump(), clang::MangleContext::mangleObjCMethodName(), clang::DeclarationName::print(), clang::JSONNodeDumper::VisitObjCMessageExpr(), clang::TextNodeDumper::VisitObjCMessageExpr(), clang::TextNodeDumper::VisitObjCPropertyRefExpr(), clang::JSONNodeDumper::VisitObjCSelectorExpr(), clang::TextNodeDumper::VisitObjCSelectorExpr(), and clang::TextNodeDumper::VisitObjCSubscriptRefExpr().
|
friend |
Definition at line 1048 of file IdentifierTable.h.
References DeclarationName.
Referenced by DeclarationName.
|
friend |
|
friend |
Definition at line 1047 of file IdentifierTable.h.
References SelectorTable.
Referenced by SelectorTable.