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
uncaught_exceptions_domaint::make_top
void make_top()
Definition: uncaught_exceptions_analysis.h:39
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
class_hierarchyt
Non-graph-based representation of the class hierarchy.
Definition: class_hierarchy.h:42
uncaught_exceptions_analysist::operator()
void operator()(const goto_functionst &, const namespacet &, exceptions_mapt &)
Applies the uncaught exceptions analysis and outputs the result.
Definition: uncaught_exceptions_analysis.cpp:242
uncaught_exceptions_analysist::output
void output(const goto_functionst &) const
Prints the exceptions map that maps each method to the set of exceptions that may escape it.
Definition: uncaught_exceptions_analysis.cpp:214
uncaught_exceptions_domaint::get_elements
const std::set< irep_idt > & get_elements() const
Returns the value of the private member thrown.
Definition: uncaught_exceptions_analysis.cpp:166
exprt
Base class for all expressions.
Definition: expr.h:55
uncaught_exceptions_domaint::transform
void transform(const goto_programt::const_targett, uncaught_exceptions_analysist &, const namespacet &)
The transformer for the uncaught exceptions domain.
Definition: uncaught_exceptions_analysis.cpp:63
uncaught_exceptions_analysist::collect_uncaught_exceptions
void collect_uncaught_exceptions(const goto_functionst &, const namespacet &)
Runs the uncaught exceptions analysis, which populates the exceptions map.
Definition: uncaught_exceptions_analysis.cpp:179
uncaught_exceptions_domaint::thrown
std::set< irep_idt > thrown
Definition: uncaught_exceptions_analysis.h:56
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
uncaught_exceptions_domaint::stack_caught
stack_caughtt stack_caught
Definition: uncaught_exceptions_analysis.h:55
uncaught_exceptions_domaint::join
void join(const irep_idt &)
The join operator for the uncaught exceptions domain.
Definition: uncaught_exceptions_analysis.cpp:43
uncaught_exceptions_domaint::stack_caughtt
std::vector< std::set< irep_idt > > stack_caughtt
Definition: uncaught_exceptions_analysis.h:54
uncaught_exceptions_domaint::class_hierarchy
class_hierarchyt class_hierarchy
Definition: uncaught_exceptions_analysis.h:57
uncaught_exceptions_analysist::exceptions_mapt
std::map< irep_idt, std::set< irep_idt > > exceptions_mapt
Definition: uncaught_exceptions_analysis.h:65
uncaught_exceptions_domaint::get_exception_symbol
static exprt get_exception_symbol(const exprt &exor)
Returns the symbol corresponding to an exception.
Definition: uncaught_exceptions_analysis.cpp:34
goto_program.h
uncaught_exceptions_analysist::domain
uncaught_exceptions_domaint domain
Definition: uncaught_exceptions_analysis.h:81
goto_functionst
A collection of goto functions.
Definition: goto_functions.h:24
class_hierarchy.h
uncaught_exceptions
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.
Definition: uncaught_exceptions_analysis.cpp:254
uncaught_exceptions_analysist::exceptions_map
exceptions_mapt exceptions_map
Definition: uncaught_exceptions_analysis.h:82
uncaught_exceptions_domaint::operator()
void operator()(const namespacet &ns)
Constructs the class hierarchy.
Definition: uncaught_exceptions_analysis.cpp:172
uncaught_exceptions_domaint
Definition: uncaught_exceptions_analysis.h:28
uncaught_exceptions_analysist
computes in exceptions_map an overapproximation of the exceptions thrown by each method
Definition: uncaught_exceptions_analysis.h:62
goto_programt::const_targett
instructionst::const_iterator const_targett
Definition: goto_program.h:587
pointer_typet
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
Definition: pointer_expr.h:23
uncaught_exceptions_domaint::get_exception_type
static irep_idt get_exception_type(const pointer_typet &)
Returns the compile type of an exception.
Definition: uncaught_exceptions_analysis.cpp:25