cprover
symbol_tablet Class Reference

The symbol table. More...

#include <symbol_table.h>

Inheritance diagram for symbol_tablet:
[legend]
Collaboration diagram for symbol_tablet:
[legend]

Public Member Functions

 symbol_tablet ()
 
 symbol_tablet (const symbol_tablet &other)
 
symbol_tabletoperator= (const symbol_tablet &other)
 
 symbol_tablet (symbol_tablet &&other)
 
symbol_tabletoperator= (symbol_tablet &&other)
 
void swap (symbol_tablet &other)
 
virtual const symbol_tabletget_symbol_table () const override
 
virtual symboltget_writeable (const irep_idt &name) override
 Find a symbol in the symbol table for read-write access. More...
 
virtual std::pair< symbolt &, bool > insert (symbolt symbol) override
 Author: Diffblue Ltd. More...
 
virtual bool move (symbolt &symbol, symbolt *&new_symbol) override
 Move a symbol into the symbol table. More...
 
virtual void erase (const symbolst::const_iterator &entry) override
 Remove a symbol from the symbol table. More...
 
virtual void clear () override
 
virtual iteratort begin () override
 
virtual iteratort end () override
 
- Public Member Functions inherited from symbol_table_baset
 symbol_table_baset (const symbolst &symbols, const symbol_base_mapt &symbol_base_map, const symbol_module_mapt &symbol_module_map)
 
 symbol_table_baset (const symbol_table_baset &other)=delete
 
symbol_table_basetoperator= (const symbol_table_baset &other)=delete
 
virtual ~symbol_table_baset ()
 Author: Diffblue Ltd. More...
 
 operator const symbol_tablet & () const
 Permits implicit cast to const symbol_tablet &. More...
 
bool has_symbol (const irep_idt &name) const
 Check whether a symbol exists in the symbol table. More...
 
const symboltlookup (const irep_idt &name) const
 Find a symbol in the symbol table for read-only access. More...
 
const symboltlookup_ref (const irep_idt &name) const
 Find a symbol in the symbol table for read-only access. More...
 
symboltget_writeable_ref (const irep_idt &name)
 Find a symbol in the symbol table for read-write access. More...
 
bool add (const symbolt &symbol)
 Add a new symbol to the symbol table. More...
 
bool remove (const irep_idt &name)
 Remove a symbol from the symbol table. More...
 
void show (std::ostream &out) const
 Print the contents of the symbol table. More...
 

Private Attributes

symbolst internal_symbols
 
symbol_base_mapt internal_symbol_base_map
 
symbol_module_mapt internal_symbol_module_map
 

Additional Inherited Members

- Public Types inherited from symbol_table_baset
typedef std::unordered_map< irep_idt, symboltsymbolst
 
- Public Attributes inherited from symbol_table_baset
const symbolstsymbols
 
const symbol_base_maptsymbol_base_map
 
const symbol_module_maptsymbol_module_map
 

Detailed Description

The symbol table.

Definition at line 19 of file symbol_table.h.

Constructor & Destructor Documentation

◆ symbol_tablet() [1/3]

symbol_tablet::symbol_tablet ( )
inline

Definition at line 27 of file symbol_table.h.

Referenced by operator=().

◆ symbol_tablet() [2/3]

symbol_tablet::symbol_tablet ( const symbol_tablet other)
inline

Definition at line 35 of file symbol_table.h.

◆ symbol_tablet() [3/3]

symbol_tablet::symbol_tablet ( symbol_tablet &&  other)
inline

Definition at line 52 of file symbol_table.h.

Member Function Documentation

◆ begin()

virtual iteratort symbol_tablet::begin ( )
inlineoverridevirtual

Implements symbol_table_baset.

Definition at line 104 of file symbol_table.h.

References internal_symbols.

◆ clear()

virtual void symbol_tablet::clear ( void  )
inlineoverridevirtual

◆ end()

virtual iteratort symbol_tablet::end ( )
inlineoverridevirtual

Implements symbol_table_baset.

Definition at line 108 of file symbol_table.h.

References internal_symbols.

◆ erase()

void symbol_tablet::erase ( const symbolst::const_iterator &  entry)
overridevirtual

◆ get_symbol_table()

virtual const symbol_tablet& symbol_tablet::get_symbol_table ( ) const
inlineoverridevirtual

Implements symbol_table_baset.

Definition at line 79 of file symbol_table.h.

◆ get_writeable()

◆ insert()

std::pair< symbolt &, bool > symbol_tablet::insert ( symbolt  symbol)
overridevirtual

Author: Diffblue Ltd.

Move or copy a new symbol to the symbol table

Remarks
: This is a nicer interface than move and achieves the same result as both move and add
Parameters
symbolThe symbol to be added to the symbol table - can be moved or copied in
Returns
Returns a reference to the newly inserted symbol or to the existing symbol if a symbol with the same name already exists in the symbol table, along with a bool that is true if a new symbol was inserted.

Implements symbol_table_baset.

Definition at line 15 of file symbol_table.cpp.

References symbolt::base_name, internal_symbol_base_map, internal_symbol_module_map, internal_symbols, symbolt::module, and symbolt::name.

Referenced by string_abstractiont::add_argument(), uninitializedt::add_assertions(), string_abstractiont::add_dummy_symbol_and_value(), add_stack_depth_symbol(), string_abstractiont::build_new_symbol(), string_abstractiont::build_symbol_constant(), string_abstractiont::build_unknown(), goto_program2codet::cleanup_expr(), cpp_typecheckt::convert(), string_instrumentationt::do_strerror(), cpp_typecheckt::do_virtual_table(), function_to_call(), generate_ansi_c_start_function(), string_instrumentationt::invalidate_buffer(), jsil_entry_point(), move(), goto_symext::parameter_assignments(), cpp_typecheckt::static_and_dynamic_initialization(), cpp_typecheckt::typecheck_compound_declarator(), and c_typecheck_baset::typecheck_expr_builtin_va_arg().

◆ move()

bool symbol_tablet::move ( symbolt symbol,
symbolt *&  new_symbol 
)
overridevirtual

Move a symbol into the symbol table.

If there is already a symbol with the same name then symbol is unchanged, new_symbol points to the symbol with the same name and true is returned. Otherwise, the symbol is moved into the symbol table, symbol is destroyed, new_symbol points to its new location in the symbol table and false is returned

Parameters
symbolThe symbol to be added to the symbol table
new_symbolPointer which the function will set to either point to the symbol in the symbol table with the same name or to the symbol that has been successfully moved into the symbol table
Returns
Returns a boolean indicating whether the process failed, which should only happen if there is a symbol with the same name already in the symbol table. If the process failed then symbol is unchanged and new_symbol points to the symbol with the same name. If the process succeeded symbol is set to be empty and new_symbol points to its new location in the symbol table

Implements symbol_table_baset.

Definition at line 61 of file symbol_table.cpp.

References symbolt::base_name, insert(), symbolt::module, and symbolt::name.

Referenced by shared_bufferst::add(), java_string_library_preprocesst::add_string_type(), c_nondet_symbol_factory(), cpp_typecheckt::class_template_symbol(), cpp_declarator_convertert::convert_new_symbol(), cpp_typecheckt::convert_parameter(), w_guardst::get_guard_symbol(), symex_dereference_statet::has_failed_symbol(), introduce_temporaries(), c_typecheck_baset::move_symbol(), cpp_typecheckt::typecheck_class_template(), cpp_typecheckt::typecheck_compound_declarator(), cpp_typecheckt::typecheck_compound_type(), cpp_typecheckt::typecheck_enum_body(), cpp_typecheckt::typecheck_enum_type(), cpp_typecheckt::typecheck_function_template(), and cpp_typecheckt::typecheck_member_function().

◆ operator=() [1/2]

symbol_tablet& symbol_tablet::operator= ( const symbol_tablet other)
inline

Definition at line 46 of file symbol_table.h.

References symbol_tablet().

◆ operator=() [2/2]

symbol_tablet& symbol_tablet::operator= ( symbol_tablet &&  other)
inline

◆ swap()

void symbol_tablet::swap ( symbol_tablet other)
inline

Member Data Documentation

◆ internal_symbol_base_map

symbol_base_mapt symbol_tablet::internal_symbol_base_map
private

Definition at line 23 of file symbol_table.h.

Referenced by clear(), erase(), insert(), operator=(), and swap().

◆ internal_symbol_module_map

symbol_module_mapt symbol_tablet::internal_symbol_module_map
private

Definition at line 24 of file symbol_table.h.

Referenced by clear(), erase(), insert(), operator=(), and swap().

◆ internal_symbols

symbolst symbol_tablet::internal_symbols
private

Definition at line 22 of file symbol_table.h.

Referenced by begin(), clear(), end(), erase(), get_writeable(), insert(), operator=(), and swap().


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