Go to the documentation of this file.
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);
81 for(
const auto &s : new_symbols)
85 const symbolt *new_symbol =
nullptr;
86 if(!ns.
lookup(s, new_symbol))
88 if(new_symbol->
type.
id() == ID_code)
90 working_set.push_back(new_symbol);
114 const bool keep_file_local)
137 const bool keep_file_local,
138 const std::set<irep_idt> &keep)
146 special.insert(
"argc'");
147 special.insert(
"argv'");
148 special.insert(
"envp'");
149 special.insert(
"envp_size'");
159 special.insert(
"__new");
160 special.insert(
"__new_array");
161 special.insert(
"__placement_new");
162 special.insert(
"__placement_new_array");
163 special.insert(
"__delete");
164 special.insert(
"__delete_array");
166 special.insert(keep.begin(), keep.end());
168 for(symbol_tablet::symbolst::const_iterator
169 it=symbol_table.
symbols.begin();
170 it!=symbol_table.
symbols.end();
174 if(exported.find(it->first)!=exported.end())
178 const symbolt &symbol=it->second;
180 if(special.find(symbol.
name)!=special.end())
186 bool is_function=symbol.
type.
id()==ID_code;
191 bool is_contract = is_function && symbol.
is_property;
194 if(symbol.
mode==ID_C && is_function && is_file_local)
216 else if(has_body && is_file_local && keep_file_local)
227 if((has_initializer || !symbol.
is_extern) &&
236 for(symbol_tablet::symbolst::const_iterator
237 it=symbol_table.
symbols.begin();
238 it!=symbol_table.
symbols.end();
241 if(exported.find(it->first)==exported.end())
243 symbol_tablet::symbolst::const_iterator next=std::next(it);
244 symbol_table.
erase(it);
Class that provides messages with a built-in verbosity 'level'.
const code_with_contract_typet & to_code_with_contract_type(const typet &type)
Cast a typet to a code_with_contract_typet.
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::vector< parametert > parameterst
typet type
Type of symbol.
optionalt< std::string > main
Base class for all expressions.
irep_idt base_name
Base (non-scoped) name.
const exprt::operandst & ensures_contract() const
const exprt::operandst & assigns() const
void remove_internal_symbols(symbol_tablet &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.
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().
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
irep_idt mode
Language mode.
#define INITIALIZE_FUNCTION
const irep_idt & id() const
static void get_symbols(const namespacet &ns, const symbolt &in_symbol, find_symbols_sett &dest)
irep_idt rounding_mode_identifier()
Return the identifier of the program symbol used to store the current rounding mode.
const parameterst & parameters() const
const exprt::operandst & requires_contract() const
exprt value
Initial value of symbol.
std::unordered_set< irep_idt > find_symbols_sett
const exprt::operandst & ensures() const
const symbolst & symbols
Read-only field, used to look up symbols given their names.
const typet & return_type() const
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
irep_idt name
The unique identifier.
const exprt::operandst & requires() const