clang 22.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. | |
bool | isAnyOperatorNew () const |
bool | isAnyOperatorDelete () const |
bool | isAnyOperatorNewOrDelete () const |
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 44 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(), compare(), clang::operator<(), clang::operator<=(), clang::operator>(), and clang::operator>=().
LLVM_DUMP_METHOD void DeclarationName::dump | ( | ) | const |
Definition at line 277 of file DeclarationName.cpp.
Referenced by clang::ASTImporterLookupTable::dump().
|
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.
References isIdentifier().
Referenced by clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnIdExpression(), actOnOMPReductionKindClause(), clang::SemaOpenMP::ActOnOpenMPDeclareMapperDirectiveVarDecl(), clang::Sema::ActOnVariableDeclarator(), clang::IdentifierResolver::AddDecl(), clang::IdentifierResolver::begin(), clang::Sema::BuildMemberPointerType(), clang::Sema::BuildUsingDeclaration(), CalculateHiddenNames(), clang::Sema::CheckFieldDecl(), clang::Sema::CheckTemplateTypeArgument(), clang::Sema::CorrectTypo(), clang::UnresolvedUsingTypenameDecl::Create(), CreateNewFunctionDecl(), clang::serialization::DeclarationNameKey::DeclarationNameKey(), DiagnoseDirectIsaAccess(), DiagnoseInvalidRedeclaration(), clang::ODRDiagsEmitter::diagnoseMismatch(), clang::CodeCompletionResult::getOrderedName(), clang::SemaObjC::HandleExprPropertyRefExpr(), clang::ASTImporter::Import(), clang::IdentifierResolver::InsertDeclAfter(), isCXXSharedPtrDtor(), isEnableIf(), isMainVar(), IsStructurallyEquivalent(), clang::Sema::LookupBuiltin(), LookupMemberExpr(), clang::tooling::stdlib::Recognizer::operator()(), print(), clang::IdentifierResolver::RemoveDecl(), clang::IdentifierResolver::tryAddTopLevelDecl(), TryTypoCorrectionForCall(), clang::ASTNodeImporter::VisitBindingDecl(), clang::ASTNodeImporter::VisitEnumConstantDecl(), clang::ASTNodeImporter::VisitEnumDecl(), clang::ASTNodeImporter::VisitFieldDecl(), clang::ASTNodeImporter::VisitIndirectFieldDecl(), clang::ASTNodeImporter::VisitLabelDecl(), clang::ASTNodeImporter::VisitNamespaceDecl(), clang::ASTNodeImporter::VisitObjCCategoryDecl(), clang::ASTNodeImporter::VisitObjCInterfaceDecl(), clang::ASTNodeImporter::VisitObjCIvarDecl(), clang::ASTNodeImporter::VisitObjCPropertyDecl(), clang::ASTNodeImporter::VisitObjCProtocolDecl(), clang::ASTNodeImporter::VisitObjCTypeParamDecl(), clang::ASTNodeImporter::VisitRecordDecl(), clang::ASTNodeImporter::VisitTypedefNameDecl(), and clang::ASTNodeImporter::VisitVarDecl().
|
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.
Referenced by llvm::PointerLikeTypeTraits< clang::DeclarationName >::getAsVoidPointer(), and llvm::DenseMapInfo< clang::DeclarationName >::getHashValue().
std::string DeclarationName::getAsString | ( | ) | const |
Retrieve the human-readable string for this name.
Definition at line 228 of file DeclarationName.cpp.
References clang::Result.
Referenced by clang::Sema::BuildCXXNestedNameSpecifier(), BuiltinInvoke(), CalculateHiddenNames(), clang::Sema::CheckUsingDeclQualifier(), clang::Sema::CorrectTypo(), clang::Sema::DiagnoseEmptyLookup(), clang::Sema::diagnoseExprIntendedAsTemplateName(), diagnoseInstanceReference(), clang::LookupResult::dump(), clang::ento::FunctionCodeRegion::dumpToStream(), clang::ExternalSource::FindExternalVisibleDeclsByName(), clang::TypoCorrection::getAsString(), clang::CodeCompletionResult::getOrderedName(), getPrintableNameForEntity(), clang::Sema::LookupTemplateName(), 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.
References CXXDeductionGuideName, and getNameKind().
Referenced by compare(), clang::serialization::DeclarationNameKey::DeclarationNameKey(), DeclareImplicitMemberFunctionsWithName(), clang::CXXDeductionGuideDecl::getDeducedTemplate(), clang::ASTImporter::Import(), clang::LookupResult::isAvailableForLookup(), isDependentName(), IsStructurallyEquivalent(), NoteImplicitDeductionGuide(), print(), clang::TreeTransform< Derived >::TransformDeclarationNameInfo(), 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 510 of file DeclarationName.h.
References CXXLiteralOperatorName, and getNameKind().
Referenced by clang::Sema::CheckLiteralOperatorDeclaration(), compare(), clang::serialization::DeclarationNameKey::DeclarationNameKey(), 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 AddTypedNameChunk(), compare(), clang::Sema::diagnoseQualifiedDeclaration(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::ASTImporter::Import(), isDependentName(), IsStructurallyEquivalent(), LookupDirect(), clang::Sema::LookupQualifiedName(), print(), and clang::TreeTransform< Derived >::TransformDeclarationNameInfo().
|
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(), AddTypedNameChunk(), clang::Sema::BuildMemberReferenceExpr(), canBeDeclaredInNamespace(), compare(), CompleteNonViableCandidate(), clang::Sema::CreateOverloadedBinOp(), clang::serialization::DeclarationNameKey::DeclarationNameKey(), DeclareImplicitMemberFunctionsWithName(), EmitDiagForCXXThrowInNonThrowingFunc(), clang::Sema::getDefaultedFunctionKind(), clang::FunctionDecl::getOverloadedOperator(), clang::ASTImporter::Import(), clang::OverloadCandidateSet::OperatorRewriteInfo::isAcceptableCandidate(), isAnyOperatorDelete(), isAnyOperatorNew(), isImplicitlyDeclaredMemberFunctionName(), clang::sema::isNormalAssignmentOperator(), clang::OverloadCandidateSet::OperatorRewriteInfo::isRewrittenOperator(), clang::CXXMethodDecl::isStatic(), IsStructurallyEquivalent(), print(), resolveAllocationOverloadInterior(), clang::Sema::SetDeclDefaulted(), shouldSkipInBacktrace(), and clang::interp::Compiler< Emitter >::VisitCallExpr().
|
inlinestatic |
Definition at line 555 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 530 of file DeclarationName.h.
Referenced by clang::IdentifierResolver::AddDecl(), clang::IdentifierResolver::begin(), clang::IdentifierResolver::iterator::incrementSlowCase(), clang::IdentifierResolver::InsertDeclAfter(), clang::IdentifierResolver::IdDeclInfoMap::operator[](), clang::IdentifierResolver::RemoveDecl(), and clang::IdentifierResolver::tryAddTopLevelDecl().
|
inlinestatic |
Get a declaration name from an opaque integer returned by getAsOpaqueInteger.
Definition at line 441 of file DeclarationName.h.
Referenced by clang::FormatASTNodeDiagnosticArgument().
|
inlinestatic |
Get a declaration name from an opaque pointer returned by getAsOpaquePtr.
Definition at line 433 of file DeclarationName.h.
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::ActOnCXXMemberDeclarator(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFunctionDeclarator(), clang::ASTRecordWriter::AddDeclarationNameLoc(), clang::Sema::AddOverriddenMethods(), AddTypedNameChunk(), clang::Sema::BuildMemberPointerType(), clang::Sema::BuildUsingDeclaration(), clang::Sema::CheckExplicitObjectMemberFunction(), compare(), clang::CXXConstructorDecl::Create(), clang::CXXConversionDecl::Create(), clang::CXXDestructorDecl::Create(), CreateNewFunctionDecl(), clang::DeclarationNameLoc::DeclarationNameLoc(), DeclareImplicitMemberFunctionsWithName(), clang::Sema::DiagnoseEmptyLookup(), clang::Sema::diagnoseQualifiedDeclaration(), clang::Sema::DiagnoseUnexpandedParameterPack(), getCXXDeductionGuideTemplate(), getCXXLiteralIdentifier(), getObjCSelector(), clang::Sema::HideUsingShadowDecl(), clang::ASTImporter::Import(), clang::ASTNodeImporter::ImportDeclarationNameLoc(), clang::Sema::InstantiateFunctionDefinition(), isAnyOperatorDelete(), isAnyOperatorNew(), isImplicitlyDeclaredMemberFunctionName(), IsStructurallyEquivalent(), LookupDirect(), LookupMemberExpr(), clang::Sema::LookupQualifiedName(), print(), clang::ASTRecordReader::readDeclarationNameLoc(), clang::TreeTransform< Derived >::TransformDeclarationNameInfo(), clang::RecursiveASTVisitor< Derived >::TraverseDeclarationNameInfo(), clang::ASTDeclWriter::VisitCXXMethodDecl(), clang::ASTDeclWriter::VisitEnumDecl(), clang::ASTDeclWriter::VisitRecordDecl(), clang::ASTDeclWriter::VisitTemplateTypeParmDecl(), clang::ASTDeclWriter::VisitTypedefDecl(), clang::ASTDeclWriter::VisitUsingShadowDecl(), and clang::ASTDeclWriter::VisitVarDecl().
|
inline |
Get the Objective-C selector stored in this declaration name.
Definition at line 519 of file DeclarationName.h.
References getNameKind(), ObjCMultiArgSelector, ObjCOneArgSelector, and ObjCZeroArgSelector.
Referenced by compare(), clang::serialization::DeclarationNameKey::DeclarationNameKey(), clang::CodeCompletionResult::getOrderedName(), clang::ObjCMethodDecl::getSelector(), hasDefaultGetterName(), hasDefaultSetterName(), clang::ASTImporter::Import(), print(), clang::ASTNodeImporter::VisitObjCMethodDecl(), and clang::ASTDeclReader::VisitObjCPropertyDecl().
|
inlinestatic |
Definition at line 561 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.
References clang::detail::DeclarationNameExtra::CXXUsingDirective.
Referenced by clang::ASTImporter::Import(), and clang::DeclContext::all_lookups_iterator::operator++().
|
inline |
Definition at line 492 of file DeclarationName.h.
References CXXOperatorName, getCXXOverloadedOperator(), and getNameKind().
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::diagnoseUnavailableAlignedAllocation(), isAnyOperatorNewOrDelete(), isNonPlacementDeallocationFunction(), and clang::FunctionDecl::isUsableAsGlobalAllocationFunctionInConstantEvaluation().
|
inline |
Definition at line 480 of file DeclarationName.h.
References CXXOperatorName, getCXXOverloadedOperator(), and getNameKind().
Referenced by clang::Sema::DeclareGlobalAllocationFunction(), isAnyOperatorNewOrDelete(), and clang::interp::Compiler< Emitter >::VisitCallExpr().
|
inline |
Definition at line 504 of file DeclarationName.h.
References isAnyOperatorDelete(), and isAnyOperatorNew().
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::CheckCompletedCXXClass().
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 215 of file DeclarationName.cpp.
References getCXXDeductionGuideTemplate(), getCXXNameType(), 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 diagnoseInstanceReference(), clang::tooling::stdlib::Recognizer::operator()(), clang::index::printSymbolName(), clang::Sema::PushOnScopeChains(), shouldSkipNamelessDecl(), clang::ASTNodeImporter::VisitEnumDecl(), and clang::ASTNodeImporter::VisitIndirectFieldDecl().
|
inline |
Predicate functions for querying what type of name this is.
Definition at line 385 of file DeclarationName.h.
Referenced by clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::ActOnFunctionDeclarator(), buildLambdaCaptureFixit(), clang::ODRDiagsEmitter::diagnoseMismatch(), clang::Sema::FindHiddenVirtualMethods(), getAsIdentifierInfo(), getQualifiedNameStart(), clang::SemaObjC::HandleExprPropertyRefExpr(), clang::dataflow::hasOptionalClassName(), clang::dataflow::isCheckLikeMethod(), clang::dataflow::isFullyQualifiedNamespaceEqualTo(), clang::CXXMethodDecl::isLambdaStaticInvoker(), clang::ento::smartptr::isStdSmartPtr(), clang::isTrivialBuiltinFunction(), and methodHasName().
|
inline |
Definition at line 389 of file DeclarationName.h.
Referenced by hasDefaultSetterName().
|
inline |
Definition at line 386 of file DeclarationName.h.
Referenced by clang::CodeCompletionResult::getOrderedName(), and 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 131 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, print(), clang::Selector::print(), and printCXXConstructorDestructorName().
Referenced by clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(), clang::operator<<(), print(), and clang::index::printSymbolName().
|
inline |
Definition at line 537 of file DeclarationName.h.
References clang::T.
Referenced by clang::IdentifierResolver::AddDecl(), clang::IdentifierResolver::IdDeclInfoMap::operator[](), clang::IdentifierResolver::RemoveDecl(), and clang::IdentifierResolver::tryAddTopLevelDecl().
|
friend |
Definition at line 145 of file DeclarationName.h.
References DeclarationNameTable.
Referenced by DeclarationNameTable.
|
friend |
|
friend |
Determine whether the specified names are different.
Definition at line 551 of file DeclarationName.h.
|
friend |
Determine whether the specified names are identical.
Definition at line 546 of file DeclarationName.h.