CBMC
uncaught_exceptions_analysis.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Over-approximative uncaught exceptions analysis
4 
5 Author: Cristina David
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANALYSES_UNCAUGHT_EXCEPTIONS_ANALYSIS_H
13 #define CPROVER_ANALYSES_UNCAUGHT_EXCEPTIONS_ANALYSIS_H
14 
15 #include <map>
16 #include <set>
17 
20 
21 class goto_functionst;
22 class namespacet;
23 class pointer_typet;
24 
27 
29 {
30  public:
33  const namespacet &);
34 
35  void join(const irep_idt &);
36  void join(const std::set<irep_idt> &);
37  void join(const std::vector<irep_idt> &);
38 
39  void make_top()
40  {
41  thrown.clear();
42  stack_caught.clear();
43  }
44 
46 
47  static exprt get_exception_symbol(const exprt &exor);
48 
49  const std::set<irep_idt> &get_elements() const;
50 
51  void operator()(const namespacet &ns);
52 
53  private:
54  typedef std::vector<std::set<irep_idt>> stack_caughtt;
56  std::set<irep_idt> thrown;
58 };
59 
63 {
64 public:
65  typedef std::map<irep_idt, std::set<irep_idt>> exceptions_mapt;
66 
68  const goto_functionst &,
69  const namespacet &);
70 
71  void output(const goto_functionst &) const;
72 
73  void operator()(
74  const goto_functionst &,
75  const namespacet &,
76  exceptions_mapt &);
77 
79 
80  private:
83 };
84 
86  const goto_functionst &,
87  const namespacet &,
88  std::map<irep_idt, std::set<irep_idt>> &);
89 
90 #endif
Class Hierarchy.
Non-graph-based representation of the class hierarchy.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
Base class for all expressions.
Definition: expr.h:56
A collection of goto functions.
instructionst::const_iterator const_targett
Definition: goto_program.h:615
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
Definition: pointer_expr.h:24
computes in exceptions_map an overapproximation of the exceptions thrown by each method
void operator()(const goto_functionst &, const namespacet &, exceptions_mapt &)
Applies the uncaught exceptions analysis and outputs the result.
void output(const goto_functionst &) const
Prints the exceptions map that maps each method to the set of exceptions that may escape it.
std::map< irep_idt, std::set< irep_idt > > exceptions_mapt
void collect_uncaught_exceptions(const goto_functionst &, const namespacet &)
Runs the uncaught exceptions analysis, which populates the exceptions map.
static exprt get_exception_symbol(const exprt &exor)
Returns the symbol corresponding to an exception.
void transform(const goto_programt::const_targett, uncaught_exceptions_analysist &, const namespacet &)
The transformer for the uncaught exceptions domain.
void operator()(const namespacet &ns)
Constructs the class hierarchy.
std::vector< std::set< irep_idt > > stack_caughtt
const std::set< irep_idt > & get_elements() const
Returns the value of the private member thrown.
static irep_idt get_exception_type(const pointer_typet &)
Returns the compile type of an exception.
void join(const irep_idt &)
The join operator for the uncaught exceptions domain.
Concrete Goto Program.
void uncaught_exceptions(const goto_functionst &, const namespacet &, std::map< irep_idt, std::set< irep_idt >> &)
Applies the uncaught exceptions analysis and outputs the result.