Go to the documentation of this file.
27 std::vector<const symbolt *> working_set;
29 working_set.push_back(&in_symbol);
31 while(!working_set.empty())
33 const symbolt *current_symbol_ptr = working_set.back();
34 working_set.pop_back();
35 const symbolt &symbol = *current_symbol_ptr;
37 if(!dest.insert(symbol.
name).second)
45 for(
const auto &s : new_symbols)
46 working_set.push_back(&ns.
lookup(s));
48 if(symbol.
type.
id() == ID_code)
53 for(
const auto &p : parameters)
57 if(!ns.
lookup(p.get_identifier(), s))
58 working_set.push_back(s);
80 const bool keep_file_local)
88 special.insert(
"argc'");
89 special.insert(
"argv'");
90 special.insert(
"envp'");
91 special.insert(
"envp_size'");
98 special.insert(
"__new");
99 special.insert(
"__new_array");
100 special.insert(
"__placement_new");
101 special.insert(
"__placement_new_array");
102 special.insert(
"__delete");
103 special.insert(
"__delete_array");
105 for(symbol_tablet::symbolst::const_iterator
106 it=symbol_table.
symbols.begin();
107 it!=symbol_table.
symbols.end();
111 if(exported.find(it->first)!=exported.end())
115 const symbolt &symbol=it->second;
117 if(special.find(symbol.
name)!=special.end())
123 bool is_function=symbol.
type.
id()==ID_code;
127 bool has_initializer=
132 if(symbol.
mode==ID_C && is_function && is_file_local)
154 else if(has_body && is_file_local && keep_file_local)
163 if((has_initializer || !symbol.
is_extern) &&
172 for(symbol_tablet::symbolst::const_iterator
173 it=symbol_table.
symbols.begin();
174 it!=symbol_table.
symbols.end();
177 if(exported.find(it->first)==exported.end())
179 symbol_tablet::symbolst::const_iterator next=std::next(it);
180 symbol_table.
erase(it);
Class that provides messages with a built-in verbosity 'level'.
void find_type_and_expr_symbols(const exprt &src, find_symbols_sett &dest)
std::vector< parametert > parameterst
typet type
Type of symbol.
optionalt< std::string > main
irep_idt base_name
Base (non-scoped) name.
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().
bool get_bool(const irep_namet &name) const
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)
const parameterst & parameters() const
exprt value
Initial value of symbol.
std::unordered_set< irep_idt > find_symbols_sett
const symbolst & symbols
Read-only field, used to look up symbols given their names.
Remove symbols that are internal only.
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.