LLVM API Documentation

llvm::TypeSymbolTable Class Reference

#include <TypeSymbolTable.h>

Inheritance diagram for llvm::TypeSymbolTable:
[legend]
Collaboration diagram for llvm::TypeSymbolTable:
[legend]

List of all members.

Public Types

Types
typedef std::map< const
std::string, const Type * > 
TypeMap
 A mapping of names to types.
typedef TypeMap::iterator iterator
 An iterator over the TypeMap.
typedef TypeMap::const_iterator const_iterator
 A const_iterator over the TypeMap.

Public Member Functions

Constructors
 TypeSymbolTable ()
 ~TypeSymbolTable ()
Accessors
std::string getUniqueName (const StringRef &BaseName) const
 Get a unique name for a type.
Type * lookup (const StringRef &name) const
 Lookup a type by name.
iterator find (const StringRef &name)
const_iterator find (const StringRef &name) const
bool empty () const
 Determine if the symbol table is empty.
unsigned size () const
 The number of name/type pairs is returned.
void dump () const
 Print out symbol table on stderr.
Iteration
iterator begin ()
 Get an iterator to the start of the symbol table.
const_iterator begin () const
 Get a const_iterator to the start of the symbol table.
iterator end ()
 Get an iterator to the end of the symbol table.
const_iterator end () const
 Get a const_iterator to the end of the symbol table.
Mutators
void insert (const StringRef &Name, const Type *Typ)
 Insert a type under a new name.
Type * remove (iterator TI)


Detailed Description

This class provides a symbol table of name/type pairs with operations to support constructing, searching and iterating over the symbol table. The class derives from AbstractTypeUser so that the contents of the symbol table can be updated when abstract types become concrete.

Definition at line 28 of file TypeSymbolTable.h.


Member Typedef Documentation

typedef std::map<const std::string, const Type*> llvm::TypeSymbolTable::TypeMap

A mapping of names to types.

Definition at line 35 of file TypeSymbolTable.h.

An iterator over the TypeMap.

Definition at line 38 of file TypeSymbolTable.h.

typedef TypeMap::const_iterator llvm::TypeSymbolTable::const_iterator

A const_iterator over the TypeMap.

Definition at line 41 of file TypeSymbolTable.h.


Constructor & Destructor Documentation

llvm::TypeSymbolTable::TypeSymbolTable (  )  [inline]

Definition at line 48 of file TypeSymbolTable.h.

TypeSymbolTable::~TypeSymbolTable (  ) 

Definition at line 30 of file TypeSymbolTable.cpp.


Member Function Documentation

std::string TypeSymbolTable::getUniqueName ( const StringRef &  BaseName  )  const

Get a unique name for a type.

Generates a unique name for a type based on the BaseName by incrementing an integer and appending it to the name, if necessary

Returns:
the unique name

Definition at line 38 of file TypeSymbolTable.cpp.

References End, llvm::StringRef::str(), and llvm::utostr().

Referenced by insert().

Type * TypeSymbolTable::lookup ( const StringRef &  name  )  const

Lookup a type by name.

This method finds the type with the given name in the type map and returns it.

Returns:
null if the name is not found, otherwise the Type associated with the name.

Definition at line 52 of file TypeSymbolTable.cpp.

Referenced by llvm::Module::addTypeName(), llvm::Module::getTypeByName(), insert(), and LinkTypes().

TypeSymbolTable::iterator TypeSymbolTable::find ( const StringRef &  name  ) 

Lookup the type associated with name.

Returns:
end() if the name is not found, or an iterator at the entry for Type.

Definition at line 62 of file TypeSymbolTable.cpp.

Referenced by LLVMDeleteTypeName().

TypeSymbolTable::const_iterator TypeSymbolTable::find ( const StringRef &  name  )  const

Lookup the type associated with name.

Returns:
end() if the name is not found, or an iterator at the entry for Type.

Definition at line 68 of file TypeSymbolTable.cpp.

bool llvm::TypeSymbolTable::empty (  )  const [inline]

Determine if the symbol table is empty.

Returns:
true iff the symbol table is empty.

Definition at line 81 of file TypeSymbolTable.h.

Referenced by WriteTypeSymbolTable().

unsigned llvm::TypeSymbolTable::size (  )  const [inline]

The number of name/type pairs is returned.

Returns:
the size of the symbol table

Definition at line 85 of file TypeSymbolTable.h.

void TypeSymbolTable::dump (  )  const [virtual]

Print out symbol table on stderr.

This function can be used from the debugger to display the content of the symbol table while debugging.

Implements llvm::AbstractTypeUser.

Definition at line 192 of file TypeSymbolTable.cpp.

References llvm::cerr(), and DumpTypes().

Referenced by insert(), and remove().

iterator llvm::TypeSymbolTable::begin (  )  [inline]

const_iterator llvm::TypeSymbolTable::begin (  )  const [inline]

Get a const_iterator to the start of the symbol table.

Definition at line 100 of file TypeSymbolTable.h.

iterator llvm::TypeSymbolTable::end (  )  [inline]

const_iterator llvm::TypeSymbolTable::end (  )  const [inline]

Get a const_iterator to the end of the symbol table.

Definition at line 106 of file TypeSymbolTable.h.

void TypeSymbolTable::insert ( const StringRef &  Name,
const Type *  Typ 
)

Insert a type under a new name.

Inserts a type into the symbol table with the specified name. There can be a many-to-one mapping between names and types. This method allows a type with an existing entry in the symbol table to get a new name.

Definition at line 105 of file TypeSymbolTable.cpp.

References llvm::cerr(), dump(), llvm::Type::getDescription(), getUniqueName(), llvm::Type::isAbstract(), and lookup().

Referenced by llvm::Module::addTypeName(), and LinkTypes().

Type * TypeSymbolTable::remove ( iterator  TI  ) 

Remove a type at the specified position in the symbol table.

Returns:
the removed Type.

the Type that was erased from the symbol table.

Definition at line 74 of file TypeSymbolTable.cpp.

References llvm::cerr(), and dump().

Referenced by LLVMDeleteTypeName(), llvm::MSILModule::runOnModule(), StripDebugInfo(), and StripTypeSymtab().


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