clang
10.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. More... | |
Selector (uintptr_t V) | |
bool | operator== (Selector RHS) const |
operator==/!= - Indicate whether the specified selectors are identical. More... | |
bool | operator!= (Selector RHS) const |
void * | getAsOpaquePtr () const |
bool | isNull () const |
Determine whether this is the empty selector. More... | |
bool | isKeywordSelector () const |
bool | isUnarySelector () const |
bool | isKeywordSelector (ArrayRef< StringRef > Names) const |
If this selector is the specific keyword selector described by Names. More... | |
bool | isUnarySelector (StringRef Name) const |
If this selector is the specific unary selector described by Name. More... | |
unsigned | getNumArgs () const |
IdentifierInfo * | getIdentifierInfoForSlot (unsigned argIndex) const |
Retrieve the identifier at a given position in the selector. More... | |
StringRef | getNameForSlot (unsigned argIndex) const |
Retrieve the name at a given position in the selector. More... | |
std::string | getAsString () const |
Derive the full selector name (e.g. More... | |
void | print (llvm::raw_ostream &OS) const |
Prints the full selector name (e.g. "foo:bar:"). More... | |
void | dump () const |
ObjCMethodFamily | getMethodFamily () const |
Derive the conventional family of this method. More... | |
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 685 of file IdentifierTable.h.
|
default |
The default ctor should only be used when creating data structures that will contain selectors.
|
inlineexplicit |
Definition at line 740 of file IdentifierTable.h.
LLVM_DUMP_METHOD void Selector::dump | ( | ) | const |
Definition at line 496 of file IdentifierTable.cpp.
References print().
|
inline |
Definition at line 750 of file IdentifierTable.h.
Referenced by llvm::PointerLikeTypeTraits< clang::Selector >::getAsVoidPointer(), clang::ObjCPropertyRefExpr::getReceiverType(), and clang::ASTWriter::getSelectorRef().
std::string Selector::getAsString | ( | ) | const |
Derive the full selector name (e.g.
"foo:bar:") and return it as an std::string.
Definition at line 469 of file IdentifierTable.cpp.
References clang::IdentifierInfo::getName().
Referenced by clang::ast_matchers::AST_MATCHER_P(), BuildUniqueMethodName(), clang::Sema::CheckMessageArgumentTypes(), clang::Sema::CheckObjCBridgeRelatedConversions(), getReturnTypeForMethod(), isDebuggingContext(), isNSStringType(), clang::Sema::ParseObjCSelectorExpression(), RewriteOneForwardClassDecl(), clang::Sema::SelectorsForTypoCorrection(), and Write_RethrowObject().
|
inlinestatic |
Definition at line 817 of file IdentifierTable.h.
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 441 of file IdentifierTable.cpp.
References clang::MultiKeywordSelector::getIdentifierInfoForSlot().
Referenced by clang::ObjCMethodCall::argumentsMayEscape(), clang::serialization::ComputeHash(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), GetAssumedMessageSendExprType(), getExpressionTraitName(), getInstTypeMethodFamily(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), LookupMethodInReceiverType(), clang::CodeGen::CodeGenFunction::StartObjCMethod(), and startsWithWord().
|
static |
Definition at line 555 of file IdentifierTable.cpp.
References getIdentifierInfoForSlot(), clang::IdentifierInfo::getName(), clang::transformer::name(), clang::OIT_Array, clang::OIT_Dictionary, clang::OIT_Init, clang::OIT_None, clang::OIT_ReturnsSelf, clang::OIT_Singleton, clang::SFF_None, clang::SFF_NSString, and startsWithWord().
Referenced by ReplaceWithClasstype().
|
inline |
Derive the conventional family of this method.
Definition at line 809 of file IdentifierTable.h.
Referenced by checkFoundationAPI(), clang::Sema::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 452 of file IdentifierTable.cpp.
References clang::IdentifierInfo::getName().
Referenced by checkObjCPointerIntrospection(), clang::DeclarationName::compare(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), clang::Sema::DiagnoseAssignmentAsCondition(), findCapturingExpr(), getExpressionTraitName(), getFreeWhenDoneArg(), hasDefaultGetterName(), hasDefaultSetterName(), isAcceptableMethodMismatch(), isCallToSelfClass(), isKnownDeallocObjCMethodName(), isSetterLikeSelector(), isUnitTest(), rewriteToObjCProperty(), tryEmitSpecializedAllocInit(), and tryGenerateSpecializedMessageSend().
unsigned Selector::getNumArgs | ( | ) | const |
Definition at line 430 of file IdentifierTable.cpp.
References clang::detail::DeclarationNameExtra::getNumArgs().
Referenced by clang::ObjCMethodCall::argumentsMayEscape(), clang::DeclarationName::compare(), clang::serialization::ComputeHash(), clang::ObjCMethodDecl::findPropertyDecl(), getExpressionTraitName(), getFreeWhenDoneArg(), clang::ObjCSelectorExpr::getNumArgs(), clang::ObjCMethodDecl::getNumSelectorLocs(), clang::ObjCMessageExpr::getNumSelectorLocs(), clang::ASTImporter::Import(), isAcceptableObjCSelector(), isCallToSelfClass(), isSetterLikeSelector(), clang::Sema::SelectorsForTypoCorrection(), and tryGenerateSpecializedMessageSend().
|
inline |
Definition at line 813 of file IdentifierTable.h.
Referenced by DiagnoseCStringFormatDirectiveInObjCAPI().
|
inlinestatic |
Definition at line 821 of file IdentifierTable.h.
Referenced by llvm::DenseMapInfo< clang::Selector >::getTombstoneKey().
|
inline |
Definition at line 758 of file IdentifierTable.h.
Referenced by tryGenerateSpecializedMessageSend().
If this selector is the specific keyword selector described by Names.
Definition at line 415 of file IdentifierTable.cpp.
|
inline |
Determine whether this is the empty selector.
Definition at line 755 of file IdentifierTable.h.
Referenced by AddClassMessageCompletions(), clang::Sema::CodeCompleteObjCMethodDeclSelector(), clang::Sema::CodeCompleteObjCSelector(), GetAssumedMessageSendExprType(), clang::getDeclUsageType(), clang::MultiplexExternalSemaSource::GetExternalSelector(), clang::ASTImporter::Import(), clang::NSAPI::isSubclassOfNSClass(), and clang::lazyInitKeywordSelector().
|
inline |
Definition at line 762 of file IdentifierTable.h.
Referenced by clang::Sema::CheckMessageArgumentTypes(), clang::CodeCompletionResult::createCodeCompletionStringForDecl(), clang::Sema::DiagnoseAssignmentAsCondition(), findCapturingExpr(), getExpressionTraitName(), clang::ObjCMethodDecl::getNumSelectorLocs(), clang::ObjCMessageExpr::getNumSelectorLocs(), isAcceptableMethodMismatch(), isAcceptableObjCSelector(), isSetterLikeSelector(), clang::CodeGen::CodeGenFunction::StartObjCMethod(), startsWithWord(), tryEmitSpecializedAllocInit(), and tryGenerateSpecializedMessageSend().
bool Selector::isUnarySelector | ( | StringRef | Name | ) | const |
If this selector is the specific unary selector described by Name.
Definition at line 426 of file IdentifierTable.cpp.
Definition at line 746 of file IdentifierTable.h.
operator==/!= - Indicate whether the specified selectors are identical.
Definition at line 743 of file IdentifierTable.h.
void Selector::print | ( | llvm::raw_ostream & | OS | ) | const |
Prints the full selector name (e.g. "foo:bar:").
Definition at line 492 of file IdentifierTable.cpp.
References clang::getAsString().
Referenced by CompareReturnTypes(), describeUninitializedArgumentInCall(), findKnownClass(), getExpressionTraitName(), clang::MangleContext::mangleObjCMethodNameWithoutSize(), clang::DeclarationName::print(), clang::TextNodeDumper::VisitObjCMessageExpr(), clang::JSONNodeDumper::VisitObjCMessageExpr(), clang::TextNodeDumper::VisitObjCPropertyRefExpr(), clang::TextNodeDumper::VisitObjCSelectorExpr(), clang::JSONNodeDumper::VisitObjCSelectorExpr(), and clang::TextNodeDumper::VisitObjCSubscriptRefExpr().
|
friend |
Definition at line 688 of file IdentifierTable.h.
|
friend |
Definition at line 686 of file IdentifierTable.h.
|
friend |
Definition at line 687 of file IdentifierTable.h.