22 std::pair<symbolst::iterator, bool> result=
24 symbolt &new_symbol=result.first->second;
29 symbol_base_mapt::iterator base_result=
51 return std::make_pair(std::ref(new_symbol), result.second);
78 std::pair<symbolt &, bool> result=
insert(std::move(temp_symbol));
83 result.first.swap(symbol);
86 new_symbol=&result.first;
87 return !result.second;
94 const symbolt &symbol=entry->second;
98 while(base_it!=base_it_end && base_it->second!=symbol.
name)
101 base_it!=base_it_end,
102 "symbolt::base_name should not be changed "
103 "after it is added to the symbol_table "
112 while(module_it != module_it_end && module_it->second != symbol.
name)
115 module_it != module_it_end,
116 "symbolt::module should not be changed "
117 "after it is added to the symbol_table "
135 for(
const auto &elem :
symbols)
137 const auto symbol_key = elem.first;
138 const auto &symbol = elem.second;
142 vm, symbol.is_well_formed(),
"Symbol is malformed: ", symbol_key);
147 symbol.name == symbol_key,
148 "Symbol table entry must map to a symbol with the correct identifier",
149 "Symbol table key '",
151 "' maps to symbol '",
156 if(!symbol.base_name.empty())
158 const auto base_map_search =
160 const bool base_map_matches_symbol =
162 base_map_search.first,
163 base_map_search.second,
164 [&symbol_key](
const symbol_base_mapt::value_type &match) {
165 return match.second == symbol_key;
170 base_map_matches_symbol,
171 "The base_name of a symbol should map to itself",
172 "Symbol table key '",
174 "' has a base_name '",
176 "' which does not map to itself");
180 if(!symbol.module.empty())
183 bool module_map_matches_symbol =
185 module_map_search.first,
186 module_map_search.second,
187 [&symbol_key](
const symbol_module_mapt::value_type &match) {
188 return match.second == symbol_key;
193 module_map_matches_symbol,
194 "Symbol table module map should map to symbol",
195 "Symbol table key '",
197 "' has a module name of '",
199 "' which does not map to itself");
209 "Symbol table base_name map entries must map to a symbol name",
210 "base_name map entry '",
211 base_map_entry.first,
212 "' maps to non-existant symbol name '",
213 base_map_entry.second,
223 "Symbol table module map entries must map to a symbol name",
224 "base_name map entry '",
225 module_map_entry.first,
226 "' maps to non-existant symbol name '",
227 module_map_entry.second,
239 std::vector<std::pair<irep_idt, irep_idt>> v1(
242 std::vector<std::pair<irep_idt, irep_idt>> v2(
246 std::sort(v1.begin(), v1.end());
247 std::sort(v2.begin(), v2.end());
254 std::vector<std::pair<irep_idt, irep_idt>> v1(
257 std::vector<std::pair<irep_idt, irep_idt>> v2(
261 std::sort(v1.begin(), v1.end());
262 std::sort(v2.begin(), v2.end());
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.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
bool operator==(const symbol_tablet &other) const
symbolst internal_symbols
Value referenced by symbol_table_baset::symbols.
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
symbol_module_mapt internal_symbol_module_map
Value referenced by symbol_table_baset::symbol_module_map.
virtual bool move(symbolt &symbol, symbolt *&new_symbol) override
Move a symbol into the symbol table.
symbol_base_mapt internal_symbol_base_map
Value referenced by symbol_table_baset::symbol_base_map.
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
void validate(const validation_modet vm=validation_modet::INVARIANT) const
Check that the symbol table is well-formed.
irep_idt base_name
Base (non-scoped) name.
irep_idt module
Name of module the symbol belongs to.
irep_idt name
The unique identifier.
const std::string & id2string(const irep_idt &d)
#define DATA_CHECK_WITH_DIAGNOSTICS(vm, condition, message,...)