clang
6.0.0
|
DeclarationName - The name of a declaration. More...
#include "clang/AST/DeclarationName.h"
Public Types | |
enum | NameKind { Identifier, ObjCZeroArgSelector, ObjCOneArgSelector, ObjCMultiArgSelector, CXXConstructorName, CXXDestructorName, CXXConversionFunctionName, CXXDeductionGuideName, CXXOperatorName, CXXLiteralOperatorName, CXXUsingDirective } |
NameKind - The kind of name this object contains. More... | |
Public Member Functions | |
DeclarationName ()=default | |
DeclarationName - Used to create an empty selector. More... | |
DeclarationName (const IdentifierInfo *II) | |
DeclarationName (Selector Sel) | |
operator bool () const | |
bool | isEmpty () const |
Evaluates true when this declaration name is empty. More... | |
bool | isIdentifier () const |
Predicate functions for querying what type of name this is. More... | |
bool | isObjCZeroArgSelector () const |
bool | isObjCOneArgSelector () const |
NameKind | getNameKind () const |
getNameKind - Determine what kind of name this is. More... | |
bool | isDependentName () const |
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself dependent. More... | |
std::string | getAsString () const |
getNameAsString - Retrieve the human-readable string for this name. More... | |
IdentifierInfo * | getAsIdentifierInfo () const |
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier. More... | |
uintptr_t | getAsOpaqueInteger () const |
getAsOpaqueInteger - Get the representation of this declaration name as an opaque integer. More... | |
void * | getAsOpaquePtr () const |
getAsOpaquePtr - Get the representation of this declaration name as an opaque pointer. More... | |
QualType | getCXXNameType () const |
getCXXNameType - If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name. More... | |
TemplateDecl * | getCXXDeductionGuideTemplate () const |
If this name is the name of a C++ deduction guide, return the template associated with that name. More... | |
OverloadedOperatorKind | getCXXOverloadedOperator () const |
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e.g., operator+ ), retrieve the kind of overloaded operator. More... | |
IdentifierInfo * | getCXXLiteralIdentifier () const |
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier associated with it. More... | |
Selector | getObjCSelector () const |
getObjCSelector - Get the Objective-C selector stored in this declaration name. More... | |
template<typename T > | |
T * | getFETokenInfo () const |
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata with some kinds of declaration names, including normal identifiers and C++ constructors, destructors, and conversion functions. More... | |
void | setFETokenInfo (void *T) |
void | print (raw_ostream &OS, const PrintingPolicy &Policy) |
void | dump () const |
Static Public Member Functions | |
static DeclarationName | getUsingDirectiveName () |
getUsingDirectiveName - Return name for all using-directives. More... | |
static DeclarationName | getFromOpaquePtr (void *P) |
static DeclarationName | getFromOpaqueInteger (uintptr_t P) |
static DeclarationName | getEmptyMarker () |
static DeclarationName | getTombstoneMarker () |
static int | compare (DeclarationName LHS, DeclarationName RHS) |
Static Public Attributes | |
static const unsigned | NumNameKinds = CXXUsingDirective + 1 |
Friends | |
class | DeclarationNameTable |
class | NamedDecl |
bool | operator== (DeclarationName LHS, DeclarationName RHS) |
operator== - Determine whether the specified names are identical.. More... | |
bool | operator!= (DeclarationName LHS, DeclarationName RHS) |
operator!= - Determine whether the specified names are different. More... | |
DeclarationName - The name of a declaration.
In the common case, this just stores an IdentifierInfo pointer to a normal name. However, it also provides encodings for Objective-C selectors (optimizing zero- and one-argument selectors, which make up 78% percent of all selectors in Cocoa.h) and special C++ names for constructors, destructors, and conversion functions.
Definition at line 56 of file DeclarationName.h.
NameKind - The kind of name this object contains.
Definition at line 59 of file DeclarationName.h.
|
default |
DeclarationName - Used to create an empty selector.
Referenced by getEmptyMarker(), clang::DeclarationNameTable::getIdentifier(), and getTombstoneMarker().
|
inline |
Definition at line 179 of file DeclarationName.h.
|
inline |
Definition at line 185 of file DeclarationName.h.
References getUsingDirectiveName().
|
static |
Definition at line 114 of file DeclarationName.cpp.
References getAsIdentifierInfo(), clang::IdentifierInfo::getName(), getNameKind(), clang::Selector::getNumArgs(), getObjCSelector(), Identifier, ObjCMultiArgSelector, ObjCOneArgSelector, and ObjCZeroArgSelector.
Referenced by CmpProtocolNames(), getTombstoneMarker(), clang::operator<(), clang::operator<=(), clang::operator>(), and clang::operator>=().
LLVM_DUMP_METHOD void DeclarationName::dump | ( | ) | const |
Definition at line 434 of file DeclarationName.cpp.
Referenced by getTombstoneMarker().
|
inline |
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
Definition at line 228 of file DeclarationName.h.
References isIdentifier().
Referenced by compare(), clang::UnresolvedUsingTypenameDecl::Create(), clang::TypoCorrection::getCorrectionAsIdentifierInfo(), getFETokenInfo(), clang::NamedDecl::getIdentifier(), clang::Sema::HandleExprPropertyRefExpr(), clang::ASTImporter::Import(), isCXXSharedPtrDtor(), LookupBuiltin(), print(), and UseNSOptionsMacro().
|
inline |
getAsOpaqueInteger - Get the representation of this declaration name as an opaque integer.
Definition at line 236 of file DeclarationName.h.
Referenced by clang::operator<<().
|
inline |
getAsOpaquePtr - Get the representation of this declaration name as an opaque pointer.
Definition at line 240 of file DeclarationName.h.
Referenced by llvm::DenseMapInfo< clang::DeclarationName >::getHashValue().
std::string DeclarationName::getAsString | ( | ) | const |
getNameAsString - Retrieve the human-readable string for this name.
Definition at line 333 of file DeclarationName.cpp.
References clang::Result.
Referenced by clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::BuildQualifiedTemplateIdExpr(), clang::Sema::CheckUsingDeclQualifier(), getMSPropertyAttr(), clang::NamedDecl::getNameAsString(), getPrintableNameForEntity(), isObjCOneArgSelector(), and clang::DeclarationNameInfo::setCXXLiteralOperatorNameLoc().
TemplateDecl * DeclarationName::getCXXDeductionGuideTemplate | ( | ) | const |
If this name is the name of a C++ deduction guide, return the template associated with that name.
Definition at line 347 of file DeclarationName.cpp.
Referenced by getFromOpaqueInteger(), clang::ASTImporter::Import(), and clang::RecursiveASTVisitor< CallGraph >::TraverseDeclarationNameInfo().
IdentifierInfo * DeclarationName::getCXXLiteralIdentifier | ( | ) | const |
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier associated with it.
Definition at line 363 of file DeclarationName.cpp.
Referenced by getFromOpaqueInteger(), clang::FunctionDecl::getLiteralIdentifier(), and clang::ASTImporter::Import().
QualType DeclarationName::getCXXNameType | ( | ) | const |
getCXXNameType - If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name.
Definition at line 340 of file DeclarationName.cpp.
References clang::Type::Type().
Referenced by computeDeclRefDependence(), clang::Sema::DiagnoseUnexpandedParameterPack(), getFromOpaqueInteger(), clang::ASTImporter::Import(), LookupDirect(), and print().
OverloadedOperatorKind DeclarationName::getCXXOverloadedOperator | ( | ) | const |
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e.g., operator+
), retrieve the kind of overloaded operator.
Definition at line 353 of file DeclarationName.cpp.
References clang::DeclarationNameExtra::CXXConversionFunction, and clang::OO_None.
Referenced by ActOnOMPReductionKindClause(), clang::Sema::CheckEquivalentExceptionSpec(), EmitDiagForCXXThrowInNonThrowingFunc(), clang::Sema::FindAllocationFunctions(), getFromOpaqueInteger(), clang::FunctionDecl::getOverloadedOperator(), clang::hasImplicitExceptionSpec(), clang::ASTImporter::Import(), clang::FunctionDecl::isReplaceableGlobalAllocationFunction(), clang::CXXMethodDecl::isStatic(), and resolveAllocationOverload().
|
inlinestatic |
Definition at line 305 of file DeclarationName.h.
References DeclarationName().
Referenced by llvm::DenseMapInfo< clang::DeclarationName >::getEmptyKey().
|
inline |
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata with some kinds of declaration names, including normal identifiers and C++ constructors, destructors, and conversion functions.
Definition at line 287 of file DeclarationName.h.
References getAsIdentifierInfo(), setFETokenInfo(), and clang::T.
Referenced by clang::IdentifierResolver::iterator::incrementSlowCase().
|
inlinestatic |
Definition at line 248 of file DeclarationName.h.
References getCXXDeductionGuideTemplate(), getCXXLiteralIdentifier(), getCXXNameType(), getCXXOverloadedOperator(), and P.
Referenced by clang::FormatASTNodeDiagnosticArgument().
|
inlinestatic |
Definition at line 242 of file DeclarationName.h.
References P.
DeclarationName::NameKind DeclarationName::getNameKind | ( | ) | const |
getNameKind - Determine what kind of name this is.
Definition at line 280 of file DeclarationName.cpp.
References clang::DeclarationNameExtra::CXXConstructor, clang::DeclarationNameExtra::CXXConversionFunction, clang::DeclarationNameExtra::CXXDeductionGuide, clang::DeclarationNameExtra::CXXDestructor, clang::DeclarationNameExtra::CXXLiteralOperator, clang::DeclarationNameExtra::CXXUsingDirective, and clang::DeclarationNameExtra::ExtraKindOrNumArgs.
Referenced by clang::Sema::BuildMemberPointerType(), compare(), computeDeclRefDependence(), clang::CXXConstructorDecl::Create(), clang::CXXDestructorDecl::Create(), clang::CXXConversionDecl::Create(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::DeclarationNameInfo::getCXXLiteralOperatorNameLoc(), clang::DeclarationNameInfo::getCXXOperatorNameRange(), clang::getDeclUsageType(), clang::DeclarationNameInfo::getNamedTypeInfo(), getObjCSelector(), clang::Sema::HideUsingShadowDecl(), clang::ASTImporter::Import(), clang::ASTNodeImporter::ImportDeclarationNameLoc(), isObjCOneArgSelector(), LookupDirect(), print(), clang::DeclarationNameInfo::setCXXLiteralOperatorNameLoc(), clang::DeclarationNameInfo::setCXXOperatorNameRange(), clang::DeclarationNameInfo::setNamedTypeInfo(), clang::RecursiveASTVisitor< CallGraph >::TraverseDeclarationNameInfo(), clang::ASTDeclWriter::VisitCXXMethodDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), and clang::ASTDeclWriter::VisitVarDecl().
|
inline |
getObjCSelector - Get the Objective-C selector stored in this declaration name.
Definition at line 274 of file DeclarationName.h.
References getNameKind(), ObjCMultiArgSelector, ObjCOneArgSelector, and ObjCZeroArgSelector.
Referenced by compare(), hasDefaultGetterName(), hasDefaultSetterName(), clang::ASTImporter::Import(), print(), and clang::ASTDeclReader::VisitObjCPropertyDecl().
|
inlinestatic |
Definition at line 309 of file DeclarationName.h.
References compare(), DeclarationName(), dump(), clang::operator<<(), and print().
Referenced by llvm::DenseMapInfo< clang::DeclarationName >::getTombstoneKey().
|
static |
getUsingDirectiveName - Return name for all using-directives.
Definition at line 423 of file DeclarationName.cpp.
References clang::DeclarationNameExtra::CXXUsingDirective.
Referenced by DeclarationName(), clang::ASTImporter::Import(), and clang::DeclContext::all_lookups_iterator::operator++().
bool DeclarationName::isDependentName | ( | ) | const |
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself dependent.
Note that this does not capture all of the notions of "dependent name", because an identifier can be a dependent name if it is used as the callee in a call expression with dependent arguments.
Definition at line 320 of file DeclarationName.cpp.
References clang::Type::isDependentType(), clang::QualType::isNull(), and clang::T.
Referenced by clang::Sema::ActOnDependentMemberExpr(), clang::Sema::CheckMicrosoftIfExistsSymbol(), and isObjCOneArgSelector().
|
inline |
Evaluates true when this declaration name is empty.
Definition at line 198 of file DeclarationName.h.
Referenced by clang::index::printSymbolName(), and shouldSkipNamelessDecl().
|
inline |
Predicate functions for querying what type of name this is.
Definition at line 203 of file DeclarationName.h.
Referenced by clang::Sema::FindHiddenVirtualMethods(), getAsIdentifierInfo(), clang::NamedDecl::getName(), and clang::Sema::HandleExprPropertyRefExpr().
|
inline |
Definition at line 207 of file DeclarationName.h.
References getAsString(), getNameKind(), and isDependentName().
Referenced by hasDefaultSetterName().
|
inline |
Definition at line 204 of file DeclarationName.h.
Referenced by hasDefaultGetterName().
|
inlineexplicit |
Definition at line 192 of file DeclarationName.h.
void DeclarationName::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy | ||
) |
Definition at line 201 of file DeclarationName.cpp.
References clang::PrintingPolicy::adjustForCPlusPlus(), clang::C, CXXConstructorName, CXXDeductionGuideName, CXXDestructorName, CXXUsingDirective, getAsIdentifierInfo(), getCXXNameType(), getNameKind(), getObjCSelector(), Identifier, ObjCMultiArgSelector, ObjCOneArgSelector, ObjCZeroArgSelector, clang::Selector::print(), and printCXXConstructorDestructorName().
Referenced by getTombstoneMarker(), clang::operator<<(), and clang::index::printSymbolName().
void DeclarationName::setFETokenInfo | ( | void * | T | ) |
Definition at line 394 of file DeclarationName.cpp.
References clang::T.
Referenced by getFETokenInfo().
|
friend |
Definition at line 76 of file DeclarationName.h.
|
friend |
Definition at line 77 of file DeclarationName.h.
|
friend |
operator!= - Determine whether the specified names are different.
Definition at line 301 of file DeclarationName.h.
|
friend |
operator== - Determine whether the specified names are identical..
Definition at line 296 of file DeclarationName.h.
|
static |
Definition at line 73 of file DeclarationName.h.