LLVM API Documentation

llvm::TypeSymbolTable Class Reference

#include <TypeSymbolTable.h>

Inheritance diagram for llvm::TypeSymbolTable:

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

Collaboration graph
[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 std::string &BaseName) const
 Get a unique name for a type.
Typelookup (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.
Typeerase (iterator TI)
bool erase (Type *TI)
bool rename (Type *T, const std::string &new_name)

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 26 of file TypeSymbolTable.h.


Member Typedef Documentation

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

A const_iterator over the TypeMap.

Definition at line 39 of file TypeSymbolTable.h.

typedef TypeMap::iterator llvm::TypeSymbolTable::iterator

An iterator over the TypeMap.

Definition at line 36 of file TypeSymbolTable.h.

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

A mapping of names to types.

Definition at line 33 of file TypeSymbolTable.h.


Constructor & Destructor Documentation

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

Definition at line 46 of file TypeSymbolTable.h.

TypeSymbolTable::~TypeSymbolTable (  ) 

Definition at line 25 of file TypeSymbolTable.cpp.


Member Function Documentation

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::begin (  )  [inline]

Get an iterator to the start 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 188 of file TypeSymbolTable.cpp.

References DumpTypes().

Referenced by erase(), and insert().

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

Determine if the symbol table is empty.

Returns:
true iff the symbol table is empty.

Definition at line 69 of file TypeSymbolTable.h.

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.

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

Get an iterator to the end of the symbol talbe.

Definition at line 91 of file TypeSymbolTable.h.

bool TypeSymbolTable::erase ( Type TI  ) 

Remove a specific Type from the symbol table. This isn't fast, linear search, O(n), algorithm.

Returns:
true if the erase was successful (TI was found)

Definition at line 52 of file TypeSymbolTable.cpp.

References erase().

Type * TypeSymbolTable::erase ( 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 63 of file TypeSymbolTable.cpp.

References DEBUG_ABSTYPE, and dump().

Referenced by erase(), and strip().

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

Returns:
the unique name

Definition at line 33 of file TypeSymbolTable.cpp.

References llvm::utostr().

Referenced by insert().

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().

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.

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

Definition at line 44 of file TypeSymbolTable.cpp.

Referenced by insert().

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.

Returns:
true if the rename was successful (type was found)

Definition at line 131 of file TypeSymbolTable.cpp.

References insert(), and T.

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

The number of name/type pairs is returned.

Returns:
the size of the symbol table

Definition at line 73 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().


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