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

DeclarationName - The name of a declaration. More...

#include "clang/AST/DeclarationName.h"

Collaboration diagram for clang::DeclarationName:
Collaboration graph
[legend]

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...
 
IdentifierInfogetAsIdentifierInfo () 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...
 
TemplateDeclgetCXXDeductionGuideTemplate () 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...
 
IdentifierInfogetCXXLiteralIdentifier () 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 >
TgetFETokenInfo () 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...
 

Detailed Description

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.

Member Enumeration Documentation

◆ NameKind

NameKind - The kind of name this object contains.

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

Definition at line 59 of file DeclarationName.h.

Constructor & Destructor Documentation

◆ DeclarationName() [1/3]

clang::DeclarationName::DeclarationName ( )
default

◆ DeclarationName() [2/3]

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

Definition at line 179 of file DeclarationName.h.

◆ DeclarationName() [3/3]

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

Definition at line 185 of file DeclarationName.h.

References getUsingDirectiveName().

Member Function Documentation

◆ compare()

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

◆ dump()

LLVM_DUMP_METHOD void DeclarationName::dump ( ) const

Definition at line 434 of file DeclarationName.cpp.

Referenced by getTombstoneMarker().

◆ getAsIdentifierInfo()

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

◆ getAsOpaqueInteger()

uintptr_t clang::DeclarationName::getAsOpaqueInteger ( ) const
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<<().

◆ getAsOpaquePtr()

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

◆ getAsString()

std::string DeclarationName::getAsString ( ) const

◆ getCXXDeductionGuideTemplate()

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

◆ getCXXLiteralIdentifier()

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

◆ getCXXNameType()

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

◆ getCXXOverloadedOperator()

OverloadedOperatorKind DeclarationName::getCXXOverloadedOperator ( ) const

◆ getEmptyMarker()

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

◆ getFETokenInfo()

template<typename T >
T* clang::DeclarationName::getFETokenInfo ( ) const
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().

◆ getFromOpaqueInteger()

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

◆ getFromOpaquePtr()

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

Definition at line 242 of file DeclarationName.h.

References P.

◆ getNameKind()

DeclarationName::NameKind DeclarationName::getNameKind ( ) const

◆ getObjCSelector()

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

◆ getTombstoneMarker()

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

◆ getUsingDirectiveName()

DeclarationName DeclarationName::getUsingDirectiveName ( )
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++().

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

◆ isEmpty()

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

Evaluates true when this declaration name is empty.

Definition at line 198 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 203 of file DeclarationName.h.

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

◆ isObjCOneArgSelector()

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

Definition at line 207 of file DeclarationName.h.

References getAsString(), getNameKind(), and isDependentName().

Referenced by hasDefaultSetterName().

◆ isObjCZeroArgSelector()

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

Definition at line 204 of file DeclarationName.h.

Referenced by hasDefaultGetterName().

◆ operator bool()

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

Definition at line 192 of file DeclarationName.h.

◆ print()

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

◆ setFETokenInfo()

void DeclarationName::setFETokenInfo ( void *  T)

Definition at line 394 of file DeclarationName.cpp.

References clang::T.

Referenced by getFETokenInfo().

Friends And Related Function Documentation

◆ DeclarationNameTable

friend class DeclarationNameTable
friend

Definition at line 76 of file DeclarationName.h.

◆ NamedDecl

friend class NamedDecl
friend

Definition at line 77 of file DeclarationName.h.

◆ operator!=

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

operator!= - Determine whether the specified names are different.

Definition at line 301 of file DeclarationName.h.

◆ operator==

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

operator== - Determine whether the specified names are identical..

Definition at line 296 of file DeclarationName.h.

Member Data Documentation

◆ NumNameKinds

const unsigned clang::DeclarationName::NumNameKinds = CXXUsingDirective + 1
static

Definition at line 73 of file DeclarationName.h.


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