cprover
Loading...
Searching...
No Matches
empty_namespacet Class Reference

A namespacet that contains an empty symbol table, for use in tests that need a namespacet but don't actually look up any symbols. More...

#include <empty_namespace.h>

+ Inheritance diagram for empty_namespacet:
+ Collaboration diagram for empty_namespacet:

Public Member Functions

 empty_namespacet ()
 
 empty_namespacet (const empty_namespacet &)=delete
 
 empty_namespacet (empty_namespacet &&)=delete
 
empty_namespacet & operator= (const empty_namespacet &)=delete
 
empty_namespacet & operator= (empty_namespacet &&)=delete
 
- Public Member Functions inherited from namespacet
 namespacet (const symbol_table_baset &_symbol_table)
 
 namespacet (const symbol_table_baset &_symbol_table1, const symbol_table_baset &_symbol_table2)
 
 namespacet (const symbol_table_baset *_symbol_table1, const symbol_table_baset *_symbol_table2)
 
bool lookup (const irep_idt &name, const symbolt *&symbol) const override
 See documentation for namespace_baset::lookup().
 
std::size_t smallest_unused_suffix (const std::string &prefix) const override
 See documentation for namespace_baset::smallest_unused_suffix().
 
const symbol_table_baset & get_symbol_table () const
 Return first symbol table registered with the namespace.
 
const symbolt & lookup (const irep_idt &name) const
 Lookup a symbol in the namespace.
 
const symbolt & lookup (const symbol_exprt &) const
 Generic lookup function for a symbol expression in a symbol table.
 
const symbolt & lookup (const tag_typet &) const
 Generic lookup function for a tag type in a symbol table.
 
virtual bool lookup (const irep_idt &name, const symbolt *&symbol) const=0
 Searches for a symbol named name.
 
- Public Member Functions inherited from namespace_baset
const symbolt & lookup (const irep_idt &name) const
 Lookup a symbol in the namespace.
 
const symbolt & lookup (const symbol_exprt &) const
 Generic lookup function for a symbol expression in a symbol table.
 
const symbolt & lookup (const tag_typet &) const
 Generic lookup function for a tag type in a symbol table.
 
virtual ~namespace_baset ()
 
void follow_macros (exprt &) const
 Follow macros to their values in a given expression.
 
const union_typet & follow_tag (const union_tag_typet &) const
 Follow type tag of union type.
 
const struct_typet & follow_tag (const struct_tag_typet &) const
 Follow type tag of struct type.
 
const c_enum_typet & follow_tag (const c_enum_tag_typet &) const
 Follow type tag of enum type.
 
const struct_union_typet & follow_tag (const struct_or_union_tag_typet &) const
 Resolve a struct_tag_typet or union_tag_typet to the complete version.
 
virtual std::size_t smallest_unused_suffix (const std::string &prefix) const =0
 Returns the minimal integer n such that there is no symbol (in any of the symbol tables) whose name is of the form "An" where A is prefix.
 
virtual bool lookup (const irep_idt &name, const symbolt *&symbol) const =0
 Searches for a symbol named name.
 

Additional Inherited Members

- Protected Attributes inherited from namespacet
const symbol_table_baset * symbol_table1
 
const symbol_table_baset * symbol_table2
 
- Private Types inherited from symbol_table_baset
typedef std::unordered_map< irep_idt, symbolt > symbolst
 
using const_iteratort = symbolst::const_iterator
 
- Private Member Functions inherited from symbol_tablet
 symbol_tablet ()
 
 symbol_tablet (const symbol_tablet &other)
 Copy constructor.
 
symbol_tablet & operator= (const symbol_tablet &other)
 Copy assignment operator.
 
 symbol_tablet (symbol_tablet &&other)
 Move constructor.
 
symbol_tablet & operator= (symbol_tablet &&other)
 Move assignment operator.
 
void swap (symbol_tablet &other)
 Swap symbol maps between two symbol tables.
 
virtual const symbol_tablet & get_symbol_table () const override
 
virtual symbolt * get_writeable (const irep_idt &name) override
 Find a symbol in the symbol table for read-write access.
 
virtual std::pair< symbolt &, bool > insert (symbolt symbol) override
 Author: Diffblue Ltd.
 
virtual bool move (symbolt &symbol, symbolt *&new_symbol) override
 Move a symbol into the symbol table.
 
virtual void erase (const symbolst::const_iterator &entry) override
 Remove a symbol from the symbol table.
 
virtual void clear () override
 Wipe internal state of the symbol table.
 
virtual iteratort begin () override
 
virtual iteratort end () override
 
void validate (const validation_modet vm=validation_modet::INVARIANT) const override
 Check that the symbol table is well-formed.
 
bool operator== (const symbol_tablet &other) const
 
virtual iteratort begin ()=0
 
virtual const_iteratort begin () const
 
virtual iteratort end ()=0
 
virtual const_iteratort end () const
 
- Private 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_baset & operator= (const symbol_table_baset &other)=delete
 
virtual ~symbol_table_baset ()
 Author: Diffblue Ltd.
 
std::size_t next_unused_suffix (const std::string &prefix, std::size_t start_number) const
 Find smallest unused integer i so that prefix + std::to_string(i) does not exist in the list symbols.
 
virtual std::size_t next_unused_suffix (const std::string &prefix) const
 
 operator const symbol_tablet & () const
 Permits implicit cast to const symbol_tablet &.
 
virtual const symbol_tablet & get_symbol_table () const =0
 
bool has_symbol (const irep_idt &name) const
 Check whether a symbol exists in the symbol table.
 
const symbolt * lookup (const irep_idt &name) const
 Find a symbol in the symbol table for read-only access.
 
const symbolt & lookup_ref (const irep_idt &name) const
 Find a symbol in the symbol table for read-only access.
 
std::list< symbolst::const_iterator > match_name_or_base_name (const irep_idt &id) const
 Collect all symbols the name of which matches id or the base name of which matches id.
 
virtual symbolt * get_writeable (const irep_idt &name)=0
 Find a symbol in the symbol table for read-write access.
 
symbolt & get_writeable_ref (const irep_idt &name)
 Find a symbol in the symbol table for read-write access.
 
bool add (const symbolt &symbol)
 Add a new symbol to the symbol table.
 
virtual std::pair< symbolt &, bool > insert (symbolt symbol)=0
 Move or copy a new symbol to the symbol table.
 
virtual bool move (symbolt &symbol, symbolt *&new_symbol)=0
 
bool remove (const irep_idt &name)
 Remove a symbol from the symbol table.
 
virtual void erase (const symbolst::const_iterator &entry)=0
 Remove a symbol from the symbol table.
 
virtual void clear ()=0
 
void show (std::ostream &out) const
 Print the contents of the symbol table.
 
std::vector< irep_idt > sorted_symbol_names () const
 Build and return a lexicographically sorted vector of symbol names from all symbols stored in this symbol table.
 
virtual iteratort begin ()=0
 
virtual iteratort end ()=0
 
virtual const_iteratort begin () const
 
virtual const_iteratort end () const
 
virtual void validate (const validation_modet vm=validation_modet::INVARIANT) const =0
 
- Private Attributes inherited from symbol_table_baset
const symbolst & symbols
 Read-only field, used to look up symbols given their names.
 
const symbol_base_mapt & symbol_base_map
 Read-only field, used to look up symbol names given their base names.
 
const symbol_module_mapt & symbol_module_map
 Read-only field, used to look up symbol names given their modules.
 

Detailed Description

A namespacet that contains an empty symbol table, for use in tests that need a namespacet but don't actually look up any symbols.

This avoids the boilerplate of declaring a symbol_tablet and namespacet in every test.

Definition at line 22 of file empty_namespace.h.

Constructor & Destructor Documentation

◆ empty_namespacet() [1/3]

empty_namespacet::empty_namespacet ( )
inline

Definition at line 25 of file empty_namespace.h.

◆ empty_namespacet() [2/3]

empty_namespacet::empty_namespacet ( const empty_namespacet &  )
delete

◆ empty_namespacet() [3/3]

empty_namespacet::empty_namespacet ( empty_namespacet &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

empty_namespacet & empty_namespacet::operator= ( const empty_namespacet &  )
delete

◆ operator=() [2/2]

empty_namespacet & empty_namespacet::operator= ( empty_namespacet &&  )
delete

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