clang  8.0.0svn
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::DeclarationName Class Reference

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. More...
 
 DeclarationName (const IdentifierInfo *II)
 Construct a declaration name from an IdentifierInfo *. More...
 
 DeclarationName (Selector Sel)
 Construct a declaration name from an Objective-C selector. More...
 
 operator bool () const
 Evaluates true when this declaration name is non-empty. More...
 
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
 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
 Retrieve the human-readable string for this name. More...
 
IdentifierInfogetAsIdentifierInfo () const
 Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't a simple identifier. More...
 
uintptr_t getAsOpaqueInteger () const
 Get the representation of this declaration name as an opaque integer. More...
 
void * getAsOpaquePtr () const
 Get the representation of this declaration name as an opaque pointer. More...
 
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. More...
 
TemplateDeclgetCXXDeductionGuideTemplate () const
 If this name is the name of a C++ deduction guide, return the template associated with that name. More...
 
OverloadedOperatorKind getCXXOverloadedOperator () const
 If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of overloaded operator. More...
 
IdentifierInfogetCXXLiteralIdentifier () const
 If this name is the name of a literal operator, retrieve the identifier associated with it. More...
 
Selector getObjCSelector () const
 Get the Objective-C selector stored in this declaration name. More...
 
void * getFETokenInfo () const
 Get and set FETokenInfo. More...
 
void setFETokenInfo (void *T)
 
void print (raw_ostream &OS, const PrintingPolicy &Policy)
 
void dump () const
 

Static Public Member Functions

static DeclarationName getUsingDirectiveName ()
 Returns the name for all C++ using-directives. More...
 
static DeclarationName getFromOpaquePtr (void *P)
 Get a declaration name from an opaque pointer returned by getAsOpaquePtr. More...
 
static DeclarationName getFromOpaqueInteger (uintptr_t P)
 Get a declaration name from an opaque integer returned by getAsOpaqueInteger. More...
 
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. More...
 
bool operator!= (DeclarationName LHS, DeclarationName RHS)
 Determine whether the specified names are different. More...
 

Detailed Description

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 146 of file DeclarationName.h.

Member Enumeration Documentation

◆ 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 203 of file DeclarationName.h.

Constructor & Destructor Documentation

◆ DeclarationName() [1/3]

clang::DeclarationName::DeclarationName ( )
inline

Construct an empty declaration name.

Definition at line 349 of file DeclarationName.h.

◆ DeclarationName() [2/3]

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

Construct a declaration name from an IdentifierInfo *.

Definition at line 352 of file DeclarationName.h.

◆ DeclarationName() [3/3]

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

Construct a declaration name from an Objective-C selector.

Definition at line 357 of file DeclarationName.h.

Member Function Documentation

◆ compare()

int DeclarationName::compare ( DeclarationName  LHS,
DeclarationName  RHS 
)
static

◆ dump()

LLVM_DUMP_METHOD void DeclarationName::dump ( ) const

Definition at line 278 of file DeclarationName.cpp.

◆ getAsIdentifierInfo()

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

◆ getAsOpaqueInteger()

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

Get the representation of this declaration name as an opaque integer.

Definition at line 418 of file DeclarationName.h.

Referenced by clang::operator<<().

◆ getAsOpaquePtr()

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

Get the representation of this declaration name as an opaque pointer.

Definition at line 421 of file DeclarationName.h.

◆ getAsString()

std::string DeclarationName::getAsString ( ) const

◆ 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 452 of file DeclarationName.h.

Referenced by compare(), clang::ASTImporter::Import(), isDependentName(), print(), and clang::RecursiveASTVisitor< CallGraph >::TraverseDeclarationNameInfo().

◆ getCXXLiteralIdentifier()

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

If this name is the name of a literal operator, retrieve the identifier associated with it.

Definition at line 473 of file DeclarationName.h.

Referenced by compare(), clang::FunctionDecl::getLiteralIdentifier(), and clang::ASTImporter::Import().

◆ 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 440 of file DeclarationName.h.

Referenced by compare(), computeDeclRefDependence(), clang::Sema::DiagnoseUnexpandedParameterPack(), clang::ASTImporter::Import(), isDependentName(), LookupDirect(), and print().

◆ getCXXOverloadedOperator()

OverloadedOperatorKind clang::DeclarationName::getCXXOverloadedOperator ( ) const
inline

◆ getEmptyMarker()

static DeclarationName clang::DeclarationName::getEmptyMarker ( )
inlinestatic

◆ getFETokenInfo()

void* clang::DeclarationName::getFETokenInfo ( ) const
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 493 of file DeclarationName.h.

Referenced by clang::IdentifierResolver::iterator::incrementSlowCase().

◆ getFromOpaqueInteger()

static DeclarationName clang::DeclarationName::getFromOpaqueInteger ( uintptr_t  P)
inlinestatic

Get a declaration name from an opaque integer returned by getAsOpaqueInteger.

Definition at line 432 of file DeclarationName.h.

References P.

Referenced by clang::FormatASTNodeDiagnosticArgument().

◆ getFromOpaquePtr()

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

Get a declaration name from an opaque pointer returned by getAsOpaquePtr.

Definition at line 424 of file DeclarationName.h.

References P.

◆ getNameKind()

NameKind clang::DeclarationName::getNameKind ( ) const
inline

◆ getObjCSelector()

Selector clang::DeclarationName::getObjCSelector ( ) const
inline

Get the Objective-C selector stored in this declaration name.

Definition at line 482 of file DeclarationName.h.

Referenced by compare(), hasDefaultGetterName(), hasDefaultSetterName(), clang::ASTImporter::Import(), print(), and clang::ASTDeclReader::VisitObjCPropertyDecl().

◆ getTombstoneMarker()

static DeclarationName clang::DeclarationName::getTombstoneMarker ( )
inlinestatic

◆ getUsingDirectiveName()

static DeclarationName clang::DeclarationName::getUsingDirectiveName ( )
inlinestatic

Returns the name for all C++ using-directives.

Definition at line 360 of file DeclarationName.h.

References clang::detail::DeclarationNameExtra::CXXUsingDirective.

Referenced by clang::ASTImporter::Import(), and clang::DeclContext::all_lookups_iterator::operator++().

◆ isDependentName()

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::QualType::isNull().

Referenced by clang::Sema::ActOnDependentMemberExpr(), and clang::Sema::CheckMicrosoftIfExistsSymbol().

◆ isEmpty()

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

Evaluates true when this declaration name is empty.

Definition at line 373 of file DeclarationName.h.

Referenced by clang::index::printSymbolName(), and shouldSkipNamelessDecl().

◆ isIdentifier()

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

Predicate functions for querying what type of name this is.

Definition at line 376 of file DeclarationName.h.

Referenced by clang::Sema::FindHiddenVirtualMethods(), clang::NamedDecl::getName(), and clang::Sema::HandleExprPropertyRefExpr().

◆ isObjCOneArgSelector()

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

Definition at line 380 of file DeclarationName.h.

Referenced by hasDefaultSetterName().

◆ isObjCZeroArgSelector()

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

Definition at line 377 of file DeclarationName.h.

Referenced by hasDefaultGetterName().

◆ operator bool()

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

Evaluates true when this declaration name is non-empty.

Definition at line 368 of file DeclarationName.h.

◆ print()

void DeclarationName::print ( raw_ostream &  OS,
const PrintingPolicy Policy 
)

◆ setFETokenInfo()

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

Definition at line 500 of file DeclarationName.h.

Friends And Related Function Documentation

◆ DeclarationNameTable

friend class DeclarationNameTable
friend

Definition at line 147 of file DeclarationName.h.

◆ NamedDecl

friend class NamedDecl
friend

Definition at line 148 of file DeclarationName.h.

◆ operator!=

bool operator!= ( DeclarationName  LHS,
DeclarationName  RHS 
)
friend

Determine whether the specified names are different.

Definition at line 514 of file DeclarationName.h.

◆ operator==

bool operator== ( DeclarationName  LHS,
DeclarationName  RHS 
)
friend

Determine whether the specified names are identical.

Definition at line 509 of file DeclarationName.h.


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