cprover
locals.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Local variables whose address is taken
4 
5 Author: Daniel Kroening
6 
7 Date: March 2013
8 
9 \*******************************************************************/
10 
13 
14 #ifndef CPROVER_ANALYSES_LOCALS_H
15 #define CPROVER_ANALYSES_LOCALS_H
16 
18 
19 class localst
20 {
21 public:
22  explicit localst(const goto_functiont &goto_function)
23  {
24  build(goto_function);
25  }
26 
27  void output(std::ostream &out) const;
28 
29  // Returns true for all procedure-local variables,
30  // not including those with static storage duration,
31  // but including the function parameters.
32  bool is_local(const irep_idt &identifier) const
33  {
34  return locals.find(identifier) != locals.end();
35  }
36 
37  typedef std::unordered_set<irep_idt> locals_sett;
39 
40 protected:
41  void build(const goto_functiont &goto_function);
42 };
43 
44 inline std::ostream &operator<<(
45  std::ostream &out, const localst &locals)
46 {
47  locals.output(out);
48  return out;
49 }
50 
51 #endif // CPROVER_ANALYSES_LOCALS_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
localst
Definition: locals.h:20
operator<<
std::ostream & operator<<(std::ostream &out, const localst &locals)
Definition: locals.h:44
localst::output
void output(std::ostream &out) const
Definition: locals.cpp:31
localst::locals
locals_sett locals
Definition: locals.h:38
localst::locals_sett
std::unordered_set< irep_idt > locals_sett
Definition: locals.h:37
localst::is_local
bool is_local(const irep_idt &identifier) const
Definition: locals.h:32
goto_functiont
A goto function, consisting of function type (see type), function body (see body),...
Definition: goto_function.h:28
localst::build
void build(const goto_functiont &goto_function)
Definition: locals.cpp:18
localst::localst
localst(const goto_functiont &goto_function)
Definition: locals.h:22
goto_function.h
Goto Function.