class IdentifierTable

Declaration

class IdentifierTable { /* full declaration omitted */ };

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.

Declared at: clang/include/clang/Basic/IdentifierTable.h:563

Member Variables

private clang::IdentifierTable::HashTableTy HashTable
private clang::IdentifierInfoLookup* ExternalLookup

Method Overview

  • public void AddKeywords(const clang::LangOptions & LangOpts)
  • public IdentifierTable(clang::IdentifierInfoLookup * ExternalLookup = nullptr)
  • public IdentifierTable(const clang::LangOptions & LangOpts, clang::IdentifierInfoLookup * ExternalLookup = nullptr)
  • public void PrintStats() const
  • public clang::IdentifierTable::iterator begin() const
  • public clang::IdentifierTable::iterator end() const
  • public clang::IdentifierTable::iterator find(llvm::StringRef Name) const
  • public clang::IdentifierInfo & get(llvm::StringRef Name)
  • public clang::IdentifierInfo & get(llvm::StringRef Name, tok::TokenKind TokenCode)
  • public llvm::BumpPtrAllocator & getAllocator()
  • public clang::IdentifierInfoLookup * getExternalIdentifierLookup() const
  • public clang::IdentifierInfo & getOwn(llvm::StringRef Name)
  • public void setExternalIdentifierLookup(clang::IdentifierInfoLookup * IILookup)
  • public unsigned int size() const

Methods

void AddKeywords(
    const clang::LangOptions& LangOpts)

Description

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

Declared at: clang/include/clang/Basic/IdentifierTable.h:670

Parameters

const clang::LangOptions& LangOpts

IdentifierTable(clang::IdentifierInfoLookup*
                    ExternalLookup = nullptr)

Description

Create the identifier table.

Declared at: clang/include/clang/Basic/IdentifierTable.h:573

Parameters

clang::IdentifierInfoLookup* ExternalLookup = nullptr

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

Description

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

Declared at: clang/include/clang/Basic/IdentifierTable.h:577

Parameters

const clang::LangOptions& LangOpts
clang::IdentifierInfoLookup* ExternalLookup = nullptr

void PrintStats() const

Description

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

Declared at: clang/include/clang/Basic/IdentifierTable.h:666

clang::IdentifierTable::iterator begin() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:658

clang::IdentifierTable::iterator end() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:659

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

Declared at: clang/include/clang/Basic/IdentifierTable.h:662

Parameters

llvm::StringRef Name

clang::IdentifierInfo& get(llvm::StringRef Name)

Description

Return the identifier token info for the specified named identifier.

Declared at: clang/include/clang/Basic/IdentifierTable.h:596

Parameters

llvm::StringRef Name

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

Declared at: clang/include/clang/Basic/IdentifierTable.h:620

Parameters

llvm::StringRef Name
tok::TokenKind TokenCode

llvm::BumpPtrAllocator& getAllocator()

Declared at: clang/include/clang/Basic/IdentifierTable.h:590

clang::IdentifierInfoLookup*
getExternalIdentifierLookup() const

Description

Retrieve the external identifier lookup object, if any.

Declared at: clang/include/clang/Basic/IdentifierTable.h:586

clang::IdentifierInfo& getOwn(
    llvm::StringRef Name)

Description

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.

Declared at: clang/include/clang/Basic/IdentifierTable.h:633

Parameters

llvm::StringRef Name

void setExternalIdentifierLookup(
    clang::IdentifierInfoLookup* IILookup)

Description

Set the external identifier lookup mechanism.

Declared at: clang/include/clang/Basic/IdentifierTable.h:581

Parameters

clang::IdentifierInfoLookup* IILookup

unsigned int size() const

Declared at: clang/include/clang/Basic/IdentifierTable.h:660