Go to the documentation of this file.
36 if(expr.
id() != ID_symbol && expr.
operands().size() >= 1)
50 const std::set<irep_idt> &elements)
52 thrown.insert(elements.begin(), elements.end());
56 const std::vector<irep_idt> &elements)
58 thrown.insert(elements.begin(), elements.end());
70 switch(instruction.
type())
81 std::vector<irep_idt> subtypes =
90 if(!instruction.
targets.empty())
92 std::set<irep_idt> caught;
98 for(
const auto &exc : exception_list)
100 last_caught.insert(exc.id());
101 std::vector<irep_idt> subtypes=
103 last_caught.insert(subtypes.begin(), subtypes.end());
113 for(
const auto &exc_id : caught)
125 function_expr.
id()==ID_symbol,
126 "identifier expected to be a symbol");
155 DATA_INVARIANT(
false,
"Unclear what is a safe over-approximation of OTHER");
160 DATA_INVARIANT(
false,
"Only complete instructions can be analyzed");
194 if(goto_program.
empty())
217 (void)goto_functions;
221 const auto fn = gf_entry.first;
222 const exceptions_mapt::const_iterator found=
exceptions_map.find(fn);
228 const auto &fs=found->second;
231 std::cout <<
"Uncaught exceptions in function " <<
232 fn <<
": " << std::endl;
233 for(
const auto exc_id : fs)
235 std::cout << std::endl;
257 std::map<
irep_idt, std::set<irep_idt>> &exceptions_map)
260 exceptions(goto_functions, ns, exceptions_map);
const irep_idt & get_identifier() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const goto_instruction_codet & code() const
Get the code represented by this instruction.
void operator()(const goto_functionst &, const namespacet &, exceptions_mapt &)
Applies the uncaught exceptions analysis and outputs the result.
const irept & find(const irep_idt &name) const
void output(const goto_functionst &) const
Prints the exceptions map that maps each method to the set of exceptions that may escape it.
const std::set< irep_idt > & get_elements() const
Returns the value of the private member thrown.
bool empty() const
Is the program empty?
Base class for all expressions.
targetst targets
The list of successor instructions.
void transform(const goto_programt::const_targett, uncaught_exceptions_analysist &, const namespacet &)
The transformer for the uncaught exceptions domain.
function_mapt function_map
void collect_uncaught_exceptions(const goto_functionst &, const namespacet &)
Runs the uncaught exceptions analysis, which populates the exceptions map.
std::set< irep_idt > thrown
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
goto_program_instruction_typet type() const
What kind of instruction?
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool has_operands() const
Return true if there is at least one operand.
const std::string & id2string(const irep_idt &d)
stack_caughtt stack_caught
void join(const irep_idt &)
The join operator for the uncaught exceptions domain.
const irep_idt & get_identifier() const
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
class_hierarchyt class_hierarchy
std::map< irep_idt, std::set< irep_idt > > exceptions_mapt
static exprt get_exception_symbol(const exprt &exor)
Returns the symbol corresponding to an exception.
uncaught_exceptions_domaint domain
A collection of goto functions.
void uncaught_exceptions(const goto_functionst &goto_functions, const namespacet &ns, std::map< irep_idt, std::set< irep_idt >> &exceptions_map)
Applies the uncaught exceptions analysis and outputs the result.
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
exceptions_mapt exceptions_map
void operator()(const namespacet &ns)
Constructs the class hierarchy.
const typet & base_type() const
The type of the data what we point to.
A generic container class for the GOTO intermediate representation of one function.
computes in exceptions_map an overapproximation of the exceptions thrown by each method
instructionst::const_iterator const_targett
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
This class represents an instruction in the GOTO intermediate representation.
const exprt & call_function() const
Get the function that is called for FUNCTION_CALL.
#define forall_goto_program_instructions(it, program)
idst get_children_trans(const irep_idt &id) const
static irep_idt get_exception_type(const pointer_typet &)
Returns the compile type of an exception.