clang: clang::DeclarationName Class Reference (original) (raw)

The name of a declaration. More...

#include "[clang/AST/DeclarationName.h](DeclarationName%5F8h%5Fsource.html)"

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.

NameKind

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.

Enumerator
Identifier
ObjCZeroArgSelector
ObjCOneArgSelector
CXXConstructorName
CXXDestructorName
CXXConversionFunctionName
CXXOperatorName
CXXDeductionGuideName
CXXLiteralOperatorName
CXXUsingDirective
ObjCMultiArgSelector

Definition at line 208 of file DeclarationName.h.

clang::DeclarationName::DeclarationName ( ) inline

DeclarationName() [2/3]

clang::DeclarationName::DeclarationName ( const IdentifierInfo * II) inline

DeclarationName() [3/3]

clang::DeclarationName::DeclarationName ( Selector Sel) inline

Construct a declaration name from an Objective-C selector.

Definition at line 365 of file DeclarationName.h.

compare()

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>=().

dump()

LLVM_DUMP_METHOD void DeclarationName::dump ( ) const

getAsIdentifierInfo()

IdentifierInfo * clang::DeclarationName::getAsIdentifierInfo ( ) const 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().

getAsOpaqueInteger()

uintptr_t clang::DeclarationName::getAsOpaqueInteger ( ) const inline

getAsOpaquePtr()

void * clang::DeclarationName::getAsOpaquePtr ( ) const inline

getAsString()

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().

getCXXDeductionGuideTemplate()

TemplateDecl * clang::DeclarationName::getCXXDeductionGuideTemplate ( ) const 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().

getCXXLiteralIdentifier()

const IdentifierInfo * clang::DeclarationName::getCXXLiteralIdentifier ( ) const inline

getCXXNameType()

QualType clang::DeclarationName::getCXXNameType ( ) const 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().

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 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::lifetimes::isNormalAssignmentOperator(), clang::OverloadCandidateSet::OperatorRewriteInfo::isRewrittenOperator(), clang::CXXMethodDecl::isStatic(), IsStructurallyEquivalent(), print(), resolveAllocationOverloadInterior(), clang::Sema::SetDeclDefaulted(), clang::CXXDestructorDecl::setGlobalOperatorArrayDelete(), clang::CXXDestructorDecl::setOperatorArrayDelete(), clang::CXXDestructorDecl::setOperatorDelete(), clang::CXXDestructorDecl::setOperatorGlobalDelete(), shouldSkipInBacktrace(), and clang::interp::Compiler< Emitter >::VisitCallExpr().

getEmptyMarker()

getFETokenInfo()

void * clang::DeclarationName::getFETokenInfo ( ) const inline

getFromOpaqueInteger()

getFromOpaquePtr()

DeclarationName clang::DeclarationName::getFromOpaquePtr ( void * P) inlinestatic

getNameKind()

NameKind clang::DeclarationName::getNameKind ( ) const 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().

getObjCSelector()

Selector clang::DeclarationName::getObjCSelector ( ) const 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().

getTombstoneMarker()

DeclarationName clang::DeclarationName::getTombstoneMarker ( ) inlinestatic

getUsingDirectiveName()

DeclarationName clang::DeclarationName::getUsingDirectiveName ( ) inlinestatic

isAnyOperatorDelete()

bool clang::DeclarationName::isAnyOperatorDelete ( ) const inline

isAnyOperatorNew()

bool clang::DeclarationName::isAnyOperatorNew ( ) const inline

isAnyOperatorNewOrDelete()

bool clang::DeclarationName::isAnyOperatorNewOrDelete ( ) const inline

isDependentName()

bool DeclarationName::isDependentName ( ) const

isEmpty()

bool clang::DeclarationName::isEmpty ( ) const inline

isIdentifier()

bool clang::DeclarationName::isIdentifier ( ) const 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().

isObjCOneArgSelector()

bool clang::DeclarationName::isObjCOneArgSelector ( ) const inline

isObjCZeroArgSelector()

bool clang::DeclarationName::isObjCZeroArgSelector ( ) const inline

operator bool()

clang::DeclarationName::operator bool ( ) const inlineexplicit

Evaluates true when this declaration name is non-empty.

Definition at line 377 of file DeclarationName.h.

print()

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().

setFETokenInfo()

void clang::DeclarationName::setFETokenInfo ( void * T) inline

DeclarationNameTable

NamedDecl

operator!=

Determine whether the specified names are different.

Definition at line 551 of file DeclarationName.h.

operator==

Determine whether the specified names are identical.

Definition at line 546 of file DeclarationName.h.


The documentation for this class was generated from the following files: