clang API Documentation

Public Types | Public Member Functions
clang::IdentifierTable Class Reference

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

#include <IdentifierTable.h>

List of all members.

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.
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
void PrintStats () const
 Print some statistics to stderr that indicate how well the hashing is doing.
void AddKeywords (const LangOptions &LangOpts)

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


Member Typedef Documentation

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

Definition at line 513 of file IdentifierTable.h.

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

Definition at line 512 of file IdentifierTable.h.


Constructor & Destructor Documentation

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

void IdentifierTable::AddKeywords ( const LangOptions LangOpts)

AddKeywords - Add all keywords to the symbol table.

Definition at line 187 of file IdentifierTable.cpp.

References AddKeyword().

Referenced by IdentifierTable().

Definition at line 515 of file IdentifierTable.h.

Definition at line 516 of file IdentifierTable.h.

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

Return the identifier token info for the specified named identifier.

Definition at line 446 of file IdentifierTable.h.

References clang::IdentifierInfoLookup::get(), and getAllocator().

Referenced by clang::Sema::ActOnCapturedRegionStart(), clang::Sema::ActOnCharacterConstant(), clang::Sema::ActOnInstanceMessage(), clang::Sema::ActOnNumericConstant(), clang::Sema::ActOnObjCBoolLiteral(), clang::Sema::ActOnStringLiteral(), addAsFieldToClosureType(), AddCXXOperatorKeyword(), addFunctionPointerConversion(), clang::Sema::addImplicitTypedef(), clang::format::AdditionalKeywords::AdditionalKeywords(), AddKeyword(), clang::Sema::AddKnownFunctionAttributes(), AddObjCKeyValueCompletions(), AddObjCKeyword(), AddOrdinaryNameResults(), BuildImplicitMemberInitializer(), clang::ASTContext::buildImplicitRecord(), clang::ASTContext::buildImplicitTypedef(), buildMemcpyForAssignmentOp(), BuildNonArrayForRange(), clang::Sema::BuildObjCArrayLiteral(), clang::Sema::BuildObjCBoxedExpr(), clang::Sema::BuildObjCDictionaryLiteral(), clang::Sema::BuildObjCStringLiteral(), buildSingleCopyAssignRecursively(), clang::CodeGen::CGCXXABI::buildThisParam(), BuildVarDecl(), CheckKeyForObjCARCConversion(), clang::Sema::CheckObjCForCollectionOperand(), CheckProtocolMethodDefs(), cleanupDeallocOrFinalize(), clang::Sema::CodeCompleteObjCPassingType(), clang::SelectorTable::constructSetterSelector(), ConvertDeclSpecToType(), CreateAAPCSABIBuiltinVaListDecl(), CreateAArch64ABIBuiltinVaListDecl(), clang::Sema::CreateBuiltinBinOp(), clang::ObjCMethodDecl::createImplicitParams(), CreatePowerABIBuiltinVaListDecl(), clang::Sema::CreatePropertyDecl(), CreateSystemZBuiltinVaListDecl(), CreateX86_64ABIBuiltinVaListDecl(), CXXRecordMembersNamed(), clang::Sema::DeclareGlobalNewDelete(), clang::ASTReader::DecodeIdentifierInfo(), clang::Sema::DefaultLvalueConversion(), DiagnoseDirectIsaAccess(), clang::CodeGen::CodeGenFunction::EmitBlockCopyAndAutorelease(), clang::CodeGen::CodeGenFunction::EmitObjCForCollectionStmt(), clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPop(), clang::CodeGen::CodeGenFunction::EmitObjCMRRAutoreleasePoolPush(), emitReplacement(), clang::Builtin::Context::ForgetBuiltin(), GCRewriteFinalize(), generateByrefCopyHelper(), generateByrefDisposeHelper(), clang::CodeGen::CodeGenFunction::GenerateObjCAtomicGetterCopyHelperFunction(), clang::CodeGen::CodeGenFunction::GenerateObjCAtomicSetterCopyHelperFunction(), clang::ASTContext::getBlockDescriptorExtendedType(), clang::ASTContext::getBlockDescriptorType(), clang::ObjCPropertyDecl::getDefaultSynthIvarName(), clang::Sema::getFloat128Identifier(), clang::Preprocessor::getIdentifierInfo(), clang::ento::getKeywordSelectorImpl(), clang::CXXRecordDecl::getLambdaStaticInvoker(), clang::arcmt::trans::getNilString(), clang::NSAPI::getNSArraySelector(), clang::NSAPI::getNSClassId(), clang::NSAPI::getNSDictionarySelector(), getNSNumberFactoryMethod(), clang::NSAPI::getNSNumberLiteralSelector(), clang::NSAPI::getNSStringSelector(), clang::GetNullarySelector(), clang::ASTContext::getObjCProtocolDecl(), clang::Sema::getOrCreateStdNamespace(), clang::Sema::getPrintingPolicy(), clang::Sema::getSuperIdentifier(), clang::GetUnarySelector(), handleFormatAttr(), handleIBOutletCollection(), handleOwnershipAttr(), hasMember(), clang::ASTImporter::Import(), clang::Parser::Initialize(), clang::Sema::Initialize(), clang::Builtin::Context::InitializeBuiltins(), isCFStringType(), clang::Sema::isKnownName(), isMacroDefined(), isNSStringType(), isObjCPtrBlockCompatible(), clang::Sema::isStdInitializerList(), IsValidIdentifier(), clang::Sema::LookupInlineAsmField(), clang::Sema::LookupInObjCMethod(), LookupPredefedObjCSuperType(), LookupStdInitializerList(), MaybeAddSentinel(), clang::ObjCNoReturn::ObjCNoReturn(), PropertyMemoryAttribute(), rewriteToObjCProperty(), shouldRunOnFunctionOrMethod(), and transferARCOwnershipToDeclaratorChunk().

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

Definition at line 475 of file IdentifierTable.h.

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

Definition at line 440 of file IdentifierTable.h.

Referenced by get(), and getOwn().

Retrieve the external identifier lookup object, if any.

Definition at line 436 of file IdentifierTable.h.

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

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

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 269 of file IdentifierTable.cpp.

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

Set the external identifier lookup mechanism.

Definition at line 431 of file IdentifierTable.h.

Definition at line 517 of file IdentifierTable.h.


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