clang  6.0.0svn
Public Types | Public Member Functions | List of all members
clang::IdentifierTable Class Reference

Implements an efficient mapping from strings to IdentifierInfo nodes. More...

#include "clang/Basic/IdentifierTable.h"

Public Types

typedef HashTableTy::const_iterator iterator
 
typedef HashTableTy::const_iterator const_iterator
 

Public Member Functions

 IdentifierTable (const LangOptions &LangOpts, IdentifierInfoLookup *externalLookup=nullptr)
 Create the identifier table, populating it with info about the language keywords for the language specified by LangOpts. More...
 
void setExternalIdentifierLookup (IdentifierInfoLookup *IILookup)
 Set the external identifier lookup mechanism. More...
 
IdentifierInfoLookupgetExternalIdentifierLookup () const
 Retrieve the external identifier lookup object, if any. More...
 
llvm::BumpPtrAllocator & getAllocator ()
 
IdentifierInfoget (StringRef Name)
 Return the identifier token info for the specified named identifier. More...
 
IdentifierInfoget (StringRef Name, tok::TokenKind TokenCode)
 
IdentifierInfogetOwn (StringRef Name)
 Gets an IdentifierInfo for the given name without consulting external sources. More...
 
iterator begin () const
 
iterator end () const
 
unsigned size () const
 
void PrintStats () const
 Print some statistics to stderr that indicate how well the hashing is doing. More...
 
void AddKeywords (const LangOptions &LangOpts)
 AddKeywords - Add all keywords to the symbol table. More...
 

Detailed Description

Implements an efficient mapping from strings to IdentifierInfo nodes.

This has no other purpose, but this is an extremely performance-critical piece of the code, as each occurrence of every identifier goes through here when lexed.

Definition at line 465 of file IdentifierTable.h.

Member Typedef Documentation

◆ const_iterator

typedef HashTableTy::const_iterator clang::IdentifierTable::const_iterator

Definition at line 555 of file IdentifierTable.h.

◆ iterator

typedef HashTableTy::const_iterator clang::IdentifierTable::iterator

Definition at line 554 of file IdentifierTable.h.

Constructor & Destructor Documentation

◆ IdentifierTable()

IdentifierTable::IdentifierTable ( const LangOptions LangOpts,
IdentifierInfoLookup externalLookup = nullptr 
)

Create the identifier table, populating it with info about the language keywords for the language specified by LangOpts.

Definition at line 75 of file IdentifierTable.cpp.

References AddKeywords().

Member Function Documentation

◆ AddKeywords()

void IdentifierTable::AddKeywords ( const LangOptions LangOpts)

AddKeywords - Add all keywords to the symbol table.

Definition at line 207 of file IdentifierTable.cpp.

References AddKeyword().

Referenced by IdentifierTable().

◆ begin()

iterator clang::IdentifierTable::begin ( ) const
inline

Definition at line 557 of file IdentifierTable.h.

◆ end()

iterator clang::IdentifierTable::end ( ) const
inline

Definition at line 558 of file IdentifierTable.h.

◆ get() [1/2]

IdentifierInfo& clang::IdentifierTable::get ( StringRef  Name)
inline

Return the identifier token info for the specified named identifier.

Definition at line 495 of file IdentifierTable.h.

Referenced by AddCXXOperatorKeyword(), clang::format::AdditionalKeywords::AdditionalKeywords(), AddKeyword(), buildCapture(), buildMemcpyForAssignmentOp(), BuildNonArrayForRange(), clang::CodeGen::CGCXXABI::buildThisParam(), CheckKeyForObjCARCConversion(), cleanupDeallocOrFinalize(), configureBlocksRuntimeObject(), clang::Sema::DeclareGlobalNewDelete(), clang::CodeGen::CodeGenFunction::EmitBlockCopyAndAutorelease(), clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPop(), clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPush(), emitReplacement(), clang::Builtin::Context::forgetBuiltin(), clang::format::FormatTokenLexer::FormatTokenLexer(), GCRewriteFinalize(), clang::CodeGen::CodeGenFunction::GenerateBlockFunction(), clang::CodeGen::CodeGenFunction::GenerateCopyHelperFunction(), clang::CodeGen::CodeGenFunction::GenerateDestroyHelperFunction(), clang::CodeGen::CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(), clang::CodeGen::CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(), clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString(), clang::ASTContext::getBlockDescriptorExtendedType(), clang::ASTContext::getBlockDescriptorType(), clang::ASTContext::getBoolName(), clang::ASTContext::getCFConstantStringDecl(), GetCFNumberSize(), clang::ObjCPropertyDecl::getDefaultSynthIvarName(), clang::Sema::getFloat128Identifier(), getFunctionSourceLocation(), GetGCAttrTypeForType(), clang::ento::getKeywordSelector(), clang::ASTContext::getMakeIntegerSeqName(), clang::NSAPI::getNSArraySelector(), clang::NSAPI::getNSClassId(), clang::ASTContext::getNSCopyingName(), clang::NSAPI::getNSDictionarySelector(), clang::NSAPI::getNSNumberLiteralSelector(), clang::ASTContext::getNSObjectName(), clang::NSAPI::getNSSetSelector(), clang::NSAPI::getNSStringSelector(), clang::GetNullarySelector(), clang::ASTContext::getObjCProtocolDecl(), clang::Sema::getSuperIdentifier(), clang::ASTContext::getTypePackElementName(), clang::GetUnarySelector(), hasSuperInitCall(), clang::ASTImporter::Import(), clang::Parser::Initialize(), clang::Sema::Initialize(), clang::Builtin::Context::initializeBuiltins(), isCFStringType(), clang::NSAPI::isMacroDefined(), clang::Preprocessor::isMacroDefined(), isNSStringType(), clang::NSAPI::isSubclassOfNSClass(), LookupMethodInReceiverType(), LookupStdInitializerList(), lookupStdTypeTraitMember(), clang::ObjCNoReturn::ObjCNoReturn(), PropertyMemoryAttribute(), clang::TreeTransform< Derived >::RebuildShuffleVectorExpr(), ReplaceWithClasstype(), SymbolNameForMethod(), and transferARCOwnershipToDeclaratorChunk().

◆ get() [2/2]

IdentifierInfo& clang::IdentifierTable::get ( StringRef  Name,
tok::TokenKind  TokenCode 
)
inline

Definition at line 519 of file IdentifierTable.h.

◆ getAllocator()

llvm::BumpPtrAllocator& clang::IdentifierTable::getAllocator ( )
inline

Definition at line 489 of file IdentifierTable.h.

◆ getExternalIdentifierLookup()

IdentifierInfoLookup* clang::IdentifierTable::getExternalIdentifierLookup ( ) const
inline

Retrieve the external identifier lookup object, if any.

Definition at line 485 of file IdentifierTable.h.

◆ getOwn()

IdentifierInfo& clang::IdentifierTable::getOwn ( StringRef  Name)
inline

Gets an IdentifierInfo for the given name without consulting external sources.

This is a version of get() meant for external sources that want to introduce or modify an identifier. If they called get(), they would likely end up in a recursion.

Definition at line 532 of file IdentifierTable.h.

References clang::IdentifierInfo::setModulesImport().

◆ PrintStats()

void IdentifierTable::PrintStats ( ) const

Print some statistics to stderr that indicate how well the hashing is doing.

PrintStats - Print statistics about how well the identifier table is doing at hashing identifiers.

Definition at line 331 of file IdentifierTable.cpp.

Referenced by clang::FrontendAction::EndSourceFile().

◆ setExternalIdentifierLookup()

void clang::IdentifierTable::setExternalIdentifierLookup ( IdentifierInfoLookup IILookup)
inline

Set the external identifier lookup mechanism.

Definition at line 480 of file IdentifierTable.h.

◆ size()

unsigned clang::IdentifierTable::size ( ) const
inline

Definition at line 559 of file IdentifierTable.h.


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