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)
49 for(
const auto &s : new_symbols)
50 working_set.push_back(&ns.
lookup(s));
52 if(symbol.
type.
id() == ID_code)
57 for(
const auto &p : parameters)
61 if(!ns.
lookup(p.get_identifier(), s))
62 working_set.push_back(s);
77 for(
const auto &s : new_symbols)
82 if(!ns.
lookup(s, symbol_ptr))
83 working_set.push_back(symbol_ptr);
105 const bool keep_file_local)
128 const bool keep_file_local,
129 const std::set<irep_idt> &keep)
137 special.insert(
"argc'");
138 special.insert(
"argv'");
139 special.insert(
"envp'");
140 special.insert(
"envp_size'");
153 special.insert(
"__new");
154 special.insert(
"__new_array");
155 special.insert(
"__placement_new");
156 special.insert(
"__placement_new_array");
157 special.insert(
"__delete");
158 special.insert(
"__delete_array");
160 special.insert(keep.begin(), keep.end());
162 for(symbol_table_baset::symbolst::const_iterator it =
164 it != symbol_table.
symbols.end();
168 if(exported.find(it->first)!=exported.end())
172 const symbolt &symbol=it->second;
174 if(special.find(symbol.
name)!=special.end())
180 bool is_function=symbol.
type.
id()==ID_code;
185 bool is_contract = is_function && symbol.
is_property;
188 if(symbol.
mode==ID_C && is_function && is_file_local)
210 else if(has_body && is_file_local && keep_file_local)
221 if((has_initializer || !symbol.
is_extern) &&
230 for(symbol_table_baset::symbolst::const_iterator it =
232 it != symbol_table.
symbols.end();)
234 if(exported.find(it->first)==exported.end())
236 symbol_table_baset::symbolst::const_iterator next = std::next(it);
238 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)
Find identifiers of the sub expressions with id ID_symbol, considering both free and bound variables,...
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.