31 std::vector<const symbolt *> working_set;
33 working_set.push_back(&in_symbol);
35 while(!working_set.empty())
37 const symbolt *current_symbol_ptr = working_set.back();
38 working_set.pop_back();
39 const symbolt &symbol = *current_symbol_ptr;
41 if(!dest.insert(symbol.
name).second)
47 std::vector<irep_idt> loop_contracts_subs{
48 ID_C_spec_loop_invariant, ID_C_spec_decreases};
53 for(
const auto &s : new_symbols)
54 working_set.push_back(&ns.
lookup(s));
56 if(symbol.
type.
id() == ID_code)
61 for(
const auto &p : parameters)
65 if(!ns.
lookup(p.get_identifier(), s))
66 working_set.push_back(s);
81 for(
const auto &s : new_symbols)
86 if(!ns.
lookup(s, symbol_ptr))
87 working_set.push_back(symbol_ptr);
109 const bool keep_file_local)
132 const bool keep_file_local,
133 const std::set<irep_idt> &keep)
141 special.insert(
"argc'");
142 special.insert(
"argv'");
143 special.insert(
"envp'");
144 special.insert(
"envp_size'");
157 special.insert(
"__new");
158 special.insert(
"__new_array");
159 special.insert(
"__placement_new");
160 special.insert(
"__placement_new_array");
161 special.insert(
"__delete");
162 special.insert(
"__delete_array");
164 special.insert(keep.begin(), keep.end());
166 for(symbol_table_baset::symbolst::const_iterator it =
168 it != symbol_table.
symbols.end();
172 if(exported.find(it->first)!=exported.end())
176 const symbolt &symbol=it->second;
178 if(special.find(symbol.
name)!=special.end())
184 bool is_function=symbol.
type.
id()==ID_code;
189 bool is_contract = is_function && symbol.
is_property;
192 if(symbol.
mode==ID_C && is_function && is_file_local)
214 else if(has_body && is_file_local && keep_file_local)
225 if((has_initializer || !symbol.
is_extern) &&
234 for(symbol_table_baset::symbolst::const_iterator it =
236 it != symbol_table.
symbols.end();)
238 if(exported.find(it->first)==exported.end())
240 symbol_table_baset::symbolst::const_iterator next = std::next(it);
242 symbol_table.
erase(it);
irep_idt rounding_mode_identifier()
Return the identifier of the program symbol used to store the current rounding mode.
const code_with_contract_typet & to_code_with_contract_type(const typet &type)
Cast a typet to a code_with_contract_typet.
std::vector< parametert > parameterst
const typet & return_type() const
const parameterst & parameters() const
const exprt::operandst & c_assigns() const
const exprt::operandst & c_requires() const
const exprt::operandst & c_ensures() const
std::optional< std::string > main
Base class for all expressions.
const irep_idt & id() const
Class that provides messages with a built-in verbosity 'level'.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
The symbol table base class interface.
virtual void erase(const symbolst::const_iterator &entry)=0
Remove a symbol from the symbol table.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
irep_idt base_name
Base (non-scoped) name.
typet type
Type of symbol.
irep_idt name
The unique identifier.
exprt value
Initial value of symbol.
irep_idt mode
Language mode.
void find_type_and_expr_symbols(const exprt &src, find_symbols_sett &dest, const std::vector< irep_idt > &subs_to_find)
Find identifiers with id ID_symbol of the sub expressions and the subs with ID in subs_to_find consid...
std::unordered_set< irep_idt > find_symbols_sett
static void get_symbols(const namespacet &ns, const symbolt &in_symbol, find_symbols_sett &dest)
void remove_internal_symbols(symbol_table_baset &symbol_table, message_handlert &mh, const bool keep_file_local)
Removes internal symbols from a symbol table A symbol is EXPORTED if it is a.
Remove symbols that are internal only.
#define INITIALIZE_FUNCTION
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.