LLVM API Documentation
#include <TypeSymbolTable.h>
Inheritance diagram for llvm::TypeSymbolTable:
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 | |
Accessors | |
std::string | getUniqueName (const std::string &BaseName) const |
Get a unique name for a type. | |
Type * | lookup (const std::string &name) const |
Lookup a type by name. | |
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 talbe. | |
const_iterator | end () const |
Get a const_iterator to the end of the symbol table. | |
Mutators | |
bool | strip () |
Strip the symbol table. | |
void | insert (const std::string &Name, const Type *Typ) |
Insert a type under a new name. | |
Type * | erase (iterator TI) |
bool | erase (Type *TI) |
bool | rename (Type *T, const std::string &new_name) |
Definition at line 26 of file TypeSymbolTable.h.
typedef std::map<const std::string, const Type*> llvm::TypeSymbolTable::TypeMap |
typedef TypeMap::const_iterator llvm::TypeSymbolTable::const_iterator |
llvm::TypeSymbolTable::TypeSymbolTable | ( | ) | [inline] |
Definition at line 46 of file TypeSymbolTable.h.
TypeSymbolTable::~TypeSymbolTable | ( | ) |
Definition at line 25 of file TypeSymbolTable.cpp.
llvm::TypeSymbolTable::TypeSymbolTable | ( | ) | [inline] |
Definition at line 46 of file TypeSymbolTable.h.
TypeSymbolTable::~TypeSymbolTable | ( | ) |
Definition at line 25 of file TypeSymbolTable.cpp.
std::string TypeSymbolTable::getUniqueName | ( | const std::string & | 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
Definition at line 33 of file TypeSymbolTable.cpp.
References llvm::utostr().
Referenced by insert().
Type * TypeSymbolTable::lookup | ( | const std::string & | name | ) | const |
Lookup a type by name.
This method finds the type with the given name
in the type map and returns it.
name
. Definition at line 44 of file TypeSymbolTable.cpp.
Referenced by insert().
bool llvm::TypeSymbolTable::empty | ( | ) | const [inline] |
Determine if the symbol table is empty.
Definition at line 69 of file TypeSymbolTable.h.
unsigned llvm::TypeSymbolTable::size | ( | ) | const [inline] |
The number of name/type pairs is returned.
Definition at line 73 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 188 of file TypeSymbolTable.cpp.
References DumpTypes().
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 88 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 94 of file TypeSymbolTable.h.
bool TypeSymbolTable::strip | ( | ) |
Strip the symbol table.
This method will strip the symbol table of its names
Definition at line 116 of file TypeSymbolTable.cpp.
References erase().
void TypeSymbolTable::insert | ( | const std::string & | 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 89 of file TypeSymbolTable.cpp.
References dump(), llvm::Type::getDescription(), getUniqueName(), llvm::Type::isAbstract(), lookup(), and T.
Referenced by rename().
Remove a type at the specified position in the symbol table.
Definition at line 63 of file TypeSymbolTable.cpp.
References DEBUG_ABSTYPE, and dump().
bool TypeSymbolTable::erase | ( | Type * | TI | ) |
Remove a specific Type from the symbol table. This isn't fast, linear search, O(n), algorithm.
Definition at line 52 of file TypeSymbolTable.cpp.
References erase().
bool TypeSymbolTable::rename | ( | Type * | T, | |
const std::string & | new_name | |||
) |
Rename a type. This ain't fast, we have to linearly search for it first.
Definition at line 131 of file TypeSymbolTable.cpp.