clang 20.0.0git
|
The name of a declaration. More...
#include "clang/AST/DeclarationName.h"
Public Types | |
enum | NameKind { Identifier = StoredIdentifier , ObjCZeroArgSelector = StoredObjCZeroArgSelector , ObjCOneArgSelector = StoredObjCOneArgSelector , CXXConstructorName = StoredCXXConstructorName , CXXDestructorName = StoredCXXDestructorName , CXXConversionFunctionName = StoredCXXConversionFunctionName , CXXOperatorName = StoredCXXOperatorName , CXXDeductionGuideName , CXXLiteralOperatorName , CXXUsingDirective , ObjCMultiArgSelector } |
The kind of the name stored in this DeclarationName. More... | |
Public Member Functions | |
DeclarationName () | |
Construct an empty declaration name. | |
DeclarationName (const IdentifierInfo *II) | |
Construct a declaration name from an IdentifierInfo *. | |
DeclarationName (Selector Sel) | |
Construct a declaration name from an Objective-C selector. | |
operator bool () const | |
Evaluates true when this declaration name is non-empty. | |
bool | isEmpty () const |
Evaluates true when this declaration name is empty. | |
bool | isIdentifier () const |
Predicate functions for querying what type of name this is. | |
bool | isObjCZeroArgSelector () const |
bool | isObjCOneArgSelector () const |
NameKind | getNameKind () const |
Determine what kind of name this is. | |
bool | isDependentName () const |
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself dependent. | |
std::string | getAsString () const |
Retrieve the human-readable string for this name. | |
IdentifierInfo * | getAsIdentifierInfo () const |
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't a simple identifier. | |
uintptr_t | getAsOpaqueInteger () const |
Get the representation of this declaration name as an opaque integer. | |
void * | getAsOpaquePtr () const |
Get the representation of this declaration name as an opaque pointer. | |
QualType | getCXXNameType () const |
If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name. | |
TemplateDecl * | getCXXDeductionGuideTemplate () const |
If this name is the name of a C++ deduction guide, return the template associated with that name. | |
OverloadedOperatorKind | getCXXOverloadedOperator () const |
If this name is the name of an overloadable operator in C++ (e.g., operator+ ), retrieve the kind of overloaded operator. | |
const IdentifierInfo * | getCXXLiteralIdentifier () const |
If this name is the name of a literal operator, retrieve the identifier associated with it. | |
Selector | getObjCSelector () const |
Get the Objective-C selector stored in this declaration name. | |
void * | getFETokenInfo () const |
Get and set FETokenInfo. | |
void | setFETokenInfo (void *T) |
void | print (raw_ostream &OS, const PrintingPolicy &Policy) const |
void | dump () const |
Static Public Member Functions | |
static DeclarationName | getUsingDirectiveName () |
Returns the name for all C++ using-directives. | |
static DeclarationName | getFromOpaquePtr (void *P) |
Get a declaration name from an opaque pointer returned by getAsOpaquePtr. | |
static DeclarationName | getFromOpaqueInteger (uintptr_t P) |
Get a declaration name from an opaque integer returned by getAsOpaqueInteger. | |
static DeclarationName | getEmptyMarker () |
static DeclarationName | getTombstoneMarker () |
static int | compare (DeclarationName LHS, DeclarationName RHS) |
Friends | |
class | DeclarationNameTable |
class | NamedDecl |
bool | operator== (DeclarationName LHS, DeclarationName RHS) |
Determine whether the specified names are identical. | |
bool | operator!= (DeclarationName LHS, DeclarationName RHS) |
Determine whether the specified names are different. | |
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), special C++ names for constructors, destructors, and conversion functions, and C++ overloaded operators.
Definition at line 144 of file DeclarationName.h.
The kind of the name stored in this DeclarationName.
The first 7 enumeration values are stored inline and correspond to frequently used kinds. The rest is stored in DeclarationNameExtra and correspond to infrequently used kinds.
Definition at line 208 of file DeclarationName.h.
|
inline |
Construct an empty declaration name.
Definition at line 357 of file DeclarationName.h.
|
inline |
Construct a declaration name from an IdentifierInfo *.
Definition at line 360 of file DeclarationName.h.
|
inline |
Construct a declaration name from an Objective-C selector.
Definition at line 365 of file DeclarationName.h.
|
static |
Definition at line 46 of file DeclarationName.cpp.
References compare(), compareInt(), CXXConstructorName, CXXConversionFunctionName, CXXDeductionGuideName, CXXDestructorName, CXXLiteralOperatorName, CXXOperatorName, CXXUsingDirective, getCXXDeductionGuideTemplate(), getCXXLiteralIdentifier(), getCXXNameType(), getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), clang::IdentifierInfo::getName(), clang::Selector::getNameForSlot(), getNameKind(), clang::Selector::getNumArgs(), getObjCSelector(), Identifier, ObjCMultiArgSelector, ObjCOneArgSelector, and ObjCZeroArgSelector.
Referenced by CmpProtocolNames(), and compare().
LLVM_DUMP_METHOD void DeclarationName::dump | ( | ) | const |
Definition at line 278 of file DeclarationName.cpp.
|
inline |
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't a simple identifier.
Definition at line 420 of file DeclarationName.h.
Referenced by actOnOMPReductionKindClause(), clang::SemaOpenMP::ActOnOpenMPDeclareMapperDirectiveVarDecl(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckTemplateTypeArgument(), clang::Sema::CorrectTypo(), clang::Sema::CorrectTypoDelayed(), clang::UnresolvedUsingTypenameDecl::Create(), DiagnoseDirectIsaAccess(), clang::ODRDiagsEmitter::diagnoseMismatch(), clang::TypoCorrection::getCorrectionAsIdentifierInfo(), clang::SemaObjC::HandleExprPropertyRefExpr(), clang::ASTImporter::Import(), isCXXSharedPtrDtor(), isEnableIf(), IsStructurallyEquivalent(), clang::Sema::LookupBuiltin(), LookupMemberExpr(), clang::tooling::stdlib::Recognizer::operator()(), print(), and TryTypoCorrectionForCall().
|
inline |
Get the representation of this declaration name as an opaque integer.
Definition at line 427 of file DeclarationName.h.
Referenced by clang::operator<<().
|
inline |
Get the representation of this declaration name as an opaque pointer.
Definition at line 430 of file DeclarationName.h.
std::string DeclarationName::getAsString | ( | ) | const |
Retrieve the human-readable string for this name.
Definition at line 229 of file DeclarationName.cpp.
References clang::Result.
Referenced by clang::Sema::BuildQualifiedDeclarationNameExpr(), clang::Sema::CheckPlaceholderExpr(), clang::Sema::CheckUsingDeclQualifier(), clang::Sema::CorrectTypo(), clang::Sema::diagnoseExprIntendedAsTemplateName(), diagnoseInstanceReference(), clang::LookupResult::dump(), clang::ento::FunctionCodeRegion::dumpToStream(), clang::TypoCorrection::getAsString(), getPrintableNameForEntity(), clang::JSONNodeDumper::VisitCXXDependentScopeMemberExpr(), and clang::JSONNodeDumper::VisitUnresolvedLookupExpr().
|
inline |
If this name is the name of a C++ deduction guide, return the template associated with that name.
Definition at line 461 of file DeclarationName.h.
Referenced by compare(), clang::CXXDeductionGuideDecl::getDeducedTemplate(), clang::ASTImporter::Import(), clang::LookupResult::isAvailableForLookup(), isDependentName(), IsStructurallyEquivalent(), NoteImplicitDeductionGuide(), print(), and clang::RecursiveASTVisitor< Derived >::TraverseDeclarationNameInfo().
|
inline |
If this name is the name of a literal operator, retrieve the identifier associated with it.
Definition at line 482 of file DeclarationName.h.
Referenced by clang::Sema::CheckLiteralOperatorDeclaration(), compare(), clang::FunctionDecl::getLiteralIdentifier(), clang::ASTImporter::Import(), IsStructurallyEquivalent(), and print().
|
inline |
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 449 of file DeclarationName.h.
Referenced by compare(), clang::DeclarationNameInfo::containsUnexpandedParameterPack(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::ASTImporter::Import(), isDependentName(), clang::DeclarationNameInfo::isInstantiationDependent(), IsStructurallyEquivalent(), LookupDirect(), and print().
|
inline |
If this name is the name of an overloadable operator in C++ (e.g., operator+
), retrieve the kind of overloaded operator.
Definition at line 472 of file DeclarationName.h.
References clang::OO_None.
Referenced by actOnOMPReductionKindClause(), clang::Sema::AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(), clang::Sema::BuildMemberReferenceExpr(), clang::Sema::CheckEquivalentExceptionSpec(), compare(), CompleteNonViableCandidate(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::diagnoseUnavailableAlignedAllocation(), EmitDiagForCXXThrowInNonThrowingFunc(), clang::Sema::FindAllocationFunctions(), clang::Sema::getDefaultedFunctionKind(), clang::FunctionDecl::getOverloadedOperator(), clang::sema::implicitObjectParamIsLifetimeBound(), clang::ASTImporter::Import(), clang::OverloadCandidateSet::OperatorRewriteInfo::isAcceptableCandidate(), clang::OverloadCandidateSet::OperatorRewriteInfo::isRewrittenOperator(), clang::CXXMethodDecl::isStatic(), IsStructurallyEquivalent(), print(), resolveAllocationOverload(), and clang::Sema::SetDeclDefaulted().
|
inlinestatic |
Definition at line 527 of file DeclarationName.h.
Referenced by llvm::DenseMapInfo< clang::DeclarationName >::getEmptyKey().
|
inline |
Get and set FETokenInfo.
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 502 of file DeclarationName.h.
|
inlinestatic |
Get a declaration name from an opaque integer returned by getAsOpaqueInteger.
Definition at line 441 of file DeclarationName.h.
References P.
Referenced by clang::FormatASTNodeDiagnosticArgument().
|
inlinestatic |
Get a declaration name from an opaque pointer returned by getAsOpaquePtr.
Definition at line 433 of file DeclarationName.h.
References P.
Referenced by llvm::PointerLikeTypeTraits< clang::DeclarationName >::getFromVoidPointer().
|
inline |
Determine what kind of name this is.
Definition at line 394 of file DeclarationName.h.
Referenced by clang::Sema::BuildMemberPointerType(), clang::Sema::BuildUsingDeclaration(), compare(), clang::DeclarationNameInfo::containsUnexpandedParameterPack(), clang::CXXDestructorDecl::Create(), clang::CXXConversionDecl::Create(), clang::CXXConstructorDecl::Create(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::Sema::HideUsingShadowDecl(), clang::ASTImporter::Import(), clang::ASTNodeImporter::ImportDeclarationNameLoc(), clang::DeclarationNameInfo::isInstantiationDependent(), IsStructurallyEquivalent(), LookupDirect(), LookupMemberExpr(), print(), clang::DeclarationNameInfo::printName(), and clang::RecursiveASTVisitor< Derived >::TraverseDeclarationNameInfo().
|
inline |
Get the Objective-C selector stored in this declaration name.
Definition at line 491 of file DeclarationName.h.
Referenced by compare(), clang::ObjCMethodDecl::getSelector(), hasDefaultGetterName(), hasDefaultSetterName(), clang::ASTImporter::Import(), print(), and clang::ASTDeclReader::VisitObjCPropertyDecl().
|
inlinestatic |
Definition at line 533 of file DeclarationName.h.
Referenced by llvm::DenseMapInfo< clang::DeclarationName >::getTombstoneKey().
|
inlinestatic |
Returns the name for all C++ using-directives.
Definition at line 369 of file DeclarationName.h.
Referenced by 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 216 of file DeclarationName.cpp.
References getCXXDeductionGuideTemplate(), getCXXNameType(), clang::Type::isDependentType(), and clang::T.
Referenced by clang::Sema::ActOnDependentMemberExpr(), and clang::Sema::CheckMicrosoftIfExistsSymbol().
|
inline |
Evaluates true when this declaration name is empty.
Definition at line 382 of file DeclarationName.h.
Referenced by checkMappableExpressionList(), diagnoseInstanceReference(), clang::tooling::stdlib::Recognizer::operator()(), clang::index::printSymbolName(), shouldSkipNamelessDecl(), and clang::ASTNodeImporter::VisitEnumDecl().
|
inline |
Predicate functions for querying what type of name this is.
Definition at line 385 of file DeclarationName.h.
Referenced by buildLambdaCaptureFixit(), clang::ODRDiagsEmitter::diagnoseMismatch(), clang::Sema::FindHiddenVirtualMethods(), clang::SemaObjC::HandleExprPropertyRefExpr(), clang::dataflow::hasOptionalClassName(), clang::dataflow::isCheckLikeMethod(), clang::CXXMethodDecl::isLambdaStaticInvoker(), clang::ento::smartptr::isStdSmartPtr(), clang::dataflow::isTopLevelNamespaceWithName(), methodHasName(), and clang::threadSafety::til::Project::slotName().
|
inline |
Definition at line 389 of file DeclarationName.h.
Referenced by hasDefaultSetterName().
|
inline |
Definition at line 386 of file DeclarationName.h.
Referenced by hasDefaultGetterName().
|
inlineexplicit |
Evaluates true when this declaration name is non-empty.
Definition at line 377 of file DeclarationName.h.
void DeclarationName::print | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy | ||
) | const |
Definition at line 132 of file DeclarationName.cpp.
References clang::PrintingPolicy::adjustForCPlusPlus(), CXXConstructorName, CXXConversionFunctionName, CXXDeductionGuideName, CXXDestructorName, CXXLiteralOperatorName, CXXOperatorName, CXXUsingDirective, clang::Type::getAs(), getAsIdentifierInfo(), getCXXDeductionGuideTemplate(), getCXXLiteralIdentifier(), getCXXNameType(), getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), clang::IdentifierInfo::getName(), getNameKind(), getObjCSelector(), clang::getOpenMPVariantManglingSeparatorStr(), clang::getOperatorSpelling(), Identifier, ObjCMultiArgSelector, ObjCOneArgSelector, ObjCZeroArgSelector, clang::Selector::print(), print(), and printCXXConstructorDestructorName().
Referenced by clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(), clang::operator<<(), print(), clang::NamedDecl::printName(), clang::DeclarationNameInfo::printName(), and clang::index::printSymbolName().
|
inline |
Definition at line 509 of file DeclarationName.h.
References clang::T.
|
friend |
Definition at line 145 of file DeclarationName.h.
|
friend |
Definition at line 146 of file DeclarationName.h.
|
friend |
Determine whether the specified names are different.
Definition at line 523 of file DeclarationName.h.
|
friend |
Determine whether the specified names are identical.
Definition at line 518 of file DeclarationName.h.