clang 22.0.0git
clang::IdentifierTable Class Reference

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

#include "clang/Basic/IdentifierTable.h"

Public Types

using iterator = HashTableTy::const_iterator
using const_iterator = HashTableTy::const_iterator

Public Member Functions

 IdentifierTable (IdentifierInfoLookup *ExternalLookup=nullptr)
 Create the identifier table.
 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.
void setExternalIdentifierLookup (IdentifierInfoLookup *IILookup)
 Set the external identifier lookup mechanism.
IdentifierInfoLookupgetExternalIdentifierLookup () const
 Retrieve the external identifier lookup object, if any.
llvm::BumpPtrAllocator & getAllocator ()
IdentifierInfoget (StringRef Name)
 Return the identifier token info for the specified named identifier.
IdentifierInfoget (StringRef Name, tok::TokenKind TokenCode)
IdentifierInfogetOwn (StringRef Name)
 Gets an IdentifierInfo for the given name without consulting external sources.
iterator begin () const
iterator end () const
unsigned size () const
iterator find (StringRef Name) const
void PrintStats () const
 Print some statistics to stderr that indicate how well the hashing is doing.
void AddKeywords (const LangOptions &LangOpts)
 Populate the identifier table with info about the language keywords for the language specified by LangOpts.
diag::kind getFutureCompatDiagKind (const IdentifierInfo &II, const LangOptions &LangOpts)
 Returns the correct diagnostic to issue for a future-compat diagnostic warning.

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 663 of file IdentifierTable.h.

Member Typedef Documentation

◆ const_iterator

using clang::IdentifierTable::const_iterator = HashTableTy::const_iterator

Definition at line 756 of file IdentifierTable.h.

◆ iterator

using clang::IdentifierTable::iterator = HashTableTy::const_iterator

Definition at line 755 of file IdentifierTable.h.

Constructor & Destructor Documentation

◆ IdentifierTable() [1/2]

IdentifierTable::IdentifierTable ( IdentifierInfoLookup * ExternalLookup = nullptr)
explicit

Create the identifier table.

Definition at line 64 of file IdentifierTable.cpp.

Referenced by IdentifierTable().

◆ IdentifierTable() [2/2]

IdentifierTable::IdentifierTable ( const LangOptions & LangOpts,
IdentifierInfoLookup * ExternalLookup = nullptr )
explicit

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

Definition at line 68 of file IdentifierTable.cpp.

References AddKeywords(), and IdentifierTable().

Member Function Documentation

◆ AddKeywords()

void IdentifierTable::AddKeywords ( const LangOptions & LangOpts)

Populate the identifier table with info about the language keywords for the language specified by LangOpts.

AddKeywords - Add all keywords to the symbol table.

Definition at line 320 of file IdentifierTable.cpp.

References AddKeyword(), get(), and clang::IdentifierInfo::setModulesImport().

Referenced by IdentifierTable().

◆ begin()

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

Definition at line 758 of file IdentifierTable.h.

◆ end()

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

Definition at line 759 of file IdentifierTable.h.

Referenced by clang::Builtin::Context::initializeBuiltins().

◆ find()

iterator clang::IdentifierTable::find ( StringRef Name) const
inline

Definition at line 762 of file IdentifierTable.h.

Referenced by clang::Builtin::Context::initializeBuiltins().

◆ get() [1/2]

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

Return the identifier token info for the specified named identifier.

Definition at line 696 of file IdentifierTable.h.

References getAllocator().

Referenced by clang::SemaOpenMP::ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(), clang::SemaHLSL::ActOnStartRootSignatureDecl(), AddCXXOperatorKeyword(), addFunctionPointerConversion(), AddKeyword(), AddKeywords(), clang::hlsl::BuiltinTypeDeclBuilder::addLoadMethods(), clang::hlsl::BuiltinTypeDeclBuilder::addMemberVariable(), AddNotableIdentifier(), AddObjCKeyword(), clang::hlsl::TemplateParameterListBuilder::addTypeParameter(), buildCapture(), buildCoroutineHandle(), buildImplicitMapper(), buildMemberCall(), buildMemcpyForAssignmentOp(), BuildNonArrayForRange(), buildSingleCopyAssignRecursively(), buildStdNoThrowDeclRef(), buildVarDecl(), BuiltinInvoke(), clang::hlsl::BuiltinTypeDeclBuilder::BuiltinTypeDeclBuilder(), clang::hlsl::BuiltinTypeMethodBuilder::BuiltinTypeMethodBuilder(), CheckKeyForObjCARCConversion(), CheckProtocolMethodDefs(), configureBlocksRuntimeObject(), clang::SelectorTable::constructSetterSelector(), CXXRecordMembersNamed(), clang::hlsl::BuiltinTypeMethodBuilder::declareLocalVar(), DiagnoseDirectIsaAccess(), clang::CodeGen::CodeGenFunction::EmitBlockCopyAndAutorelease(), emitOutlinedFunctionPrologue(), emitReplacement(), clang::ExternalSource::FindExternalVisibleDeclsByName(), findOMPAllocatorHandleT(), findOMPAlloctraitT(), findOMPDependT(), findOMPEventHandleT(), clang::CodeGen::CodeGenFunction::generateBuiltinOSLogHelperFunction(), get(), clang::ObjCPropertyDecl::getDefaultSynthIvarName(), getGlobalStreamPointerByName(), getHostLayoutStructName(), clang::getKeywordSelector(), getLambdaStaticInvokers(), getNSNumberFactoryMethod(), clang::GetNullarySelector(), getOpenCLEnumType(), getOpenCLTypedefType(), getStdTrait(), clang::GetUnarySelector(), handleAvailabilityAttr(), handleFormatAttrCommon(), handleOwnershipAttr(), hasMember(), clang::Builtin::Context::initializeBuiltins(), clang::HLSLExternalSemaSource::InitializeSema(), clang::SemaObjC::isCFStringType(), isImplicitMapperNeeded(), isMacroDefined(), clang::SemaObjC::isNSStringType(), isNSStringType(), isStdClassTemplate(), isValidInteropVariable(), lookupCoroutineHandleType(), lookupCXXRecordDecl(), clang::LookupNamed(), clang::LookupNamespace(), lookupPromiseType(), LookupStdClassTemplate(), lookupStdNamespace(), LookupStdSourceLocationImpl(), MarkIdentifierAsKeywordInCpp(), markUsedForAliasOrIfunc(), mergeDeclAttribute(), ProcessAPINotes(), processImplicitMapsWithDefaultMappers(), shouldRunOnFunctionOrMethod(), clang::syntax::tokenize(), and transferARCOwnershipToDeclaratorChunk().

◆ get() [2/2]

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

Definition at line 720 of file IdentifierTable.h.

References get().

◆ getAllocator()

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

Definition at line 690 of file IdentifierTable.h.

Referenced by get(), and getOwn().

◆ getExternalIdentifierLookup()

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

Retrieve the external identifier lookup object, if any.

Definition at line 686 of file IdentifierTable.h.

Referenced by highlightLines().

◆ getFutureCompatDiagKind()

diag::kind IdentifierTable::getFutureCompatDiagKind ( const IdentifierInfo & II,
const LangOptions & LangOpts )

Returns the correct diagnostic to issue for a future-compat diagnostic warning.

Note, this function assumes the identifier passed has already been determined to be a future compatible keyword.

Definition at line 870 of file IdentifierTable.cpp.

References clang::IdentifierInfo::getName(), and clang::IdentifierInfo::isFutureCompatKeyword().

◆ 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 733 of file IdentifierTable.h.

References getAllocator(), and clang::IdentifierInfo::setModulesImport().

Referenced by clang::CodeGen::CodeGenFunction::EmitAndRegisterVariableArrayDimensions().

◆ 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 512 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 681 of file IdentifierTable.h.

◆ size()

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

Definition at line 760 of file IdentifierTable.h.


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