47 for(
const auto &
object : objects)
49 if(
object.
id() == ID_symbol)
52 const std::set<irep_idt> &uninitialized=
54 if(uninitialized.find(identifier)!=uninitialized.end())
57 else if(
object.
id() == ID_dereference)
76 for(std::set<irep_idt>::const_iterator
87 new_symbol.module=symbol.
module;
88 new_symbol.is_thread_local=
true;
89 new_symbol.is_file_local=
true;
90 new_symbol.is_lvalue=
true;
133 const std::set<irep_idt> &uninitialized=
137 for(
const auto &
object :
read)
139 if(
object.
id() == ID_symbol)
143 if(uninitialized.find(identifier)!=uninitialized.end())
152 "use of uninitialized local variable " +
id2string(identifier));
165 for(
const auto &
object : written)
167 if(
object.
id() == ID_symbol)
196 uninitialized.
add_assertions(gf_entry.first, gf_entry.second.body);
208 if(gf_entry.second.body_available())
211 out <<
"//// Function: " << gf_entry.first <<
'\n';
214 uninitialized_analysis(gf_entry.first, gf_entry.second.body, ns);
215 uninitialized_analysis.
output(
216 ns, gf_entry.first, gf_entry.second.body, out);
virtual void output(const namespacet &ns, const irep_idt &function_id, const goto_programt &goto_program, std::ostream &out) const
Output the abstract states for a single function.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
The Boolean constant false.
function_mapt function_map
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
This class represents an instruction in the GOTO intermediate representation.
const source_locationt & source_location() const
const symbol_exprt & decl_symbol() const
Get the declared symbol for DECL.
A generic container class for the GOTO intermediate representation of one function.
void insert_before_swap(targett target)
Insertion that preserves jumps to "target".
instructionst::iterator targett
instructionst::const_iterator const_targett
static instructiont make_assignment(const code_assignt &_code, const source_locationt &l=source_locationt::nil())
Create an assignment instruction.
targett insert_after(const_targett target)
Insertion after the instruction pointed-to by the given instruction iterator target.
static instructiont make_decl(const symbol_exprt &symbol, const source_locationt &l=source_locationt::nil())
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
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().
void set_comment(const irep_idt &comment)
void set_property_class(const irep_idt &property_class)
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
The symbol table base class interface.
virtual std::pair< symbolt &, bool > insert(symbolt symbol)=0
Move or copy a new symbol to the symbol table.
irep_idt base_name
Base (non-scoped) name.
irep_idt module
Name of module the symbol belongs to.
source_locationt location
Source code location of definition of symbol.
irep_idt name
The unique identifier.
irep_idt mode
Language mode.
The Boolean constant true.
void add_assertions(const irep_idt &function_identifer, goto_programt &goto_program)
symbol_table_baset & symbol_table
std::set< irep_idt > tracking
void get_tracking(goto_programt::const_targett i_it)
which variables need tracking, i.e., are uninitialized and may be read?
uninitialized_analysist uninitialized_analysis
uninitializedt(symbol_table_baset &_symbol_table)
void objects_read(const exprt &src, std::list< exprt > &dest)
void objects_written(const exprt &src, std::list< exprt > &dest)
#define forall_goto_program_instructions(it, program)
#define Forall_goto_program_instructions(it, program)
const std::string & id2string(const irep_idt &d)
int __CPROVER_ID java::java io InputStream read
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
void add_uninitialized_locals_assertions(goto_modelt &goto_model)
void show_uninitialized(const goto_modelt &goto_model, std::ostream &out)
Detection for Uninitialized Local Variables.
Detection for Uninitialized Local Variables.