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_map.find(identifier)!=locals_map.end();
35  }
36 
37  typedef std::map<irep_idt, symbol_exprt> locals_mapt;
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
localst(const goto_functiont &goto_function)
Definition: locals.h:22
locals_mapt locals_map
Definition: locals.h:38
Definition: locals.h:19
std::ostream & operator<<(std::ostream &out, const localst &locals)
Definition: locals.h:44
std::map< irep_idt, symbol_exprt > locals_mapt
Definition: locals.h:37
bool is_local(const irep_idt &identifier) const
Definition: locals.h:32
void output(std::ostream &out) const
Definition: locals.cpp:33
void build(const goto_functiont &goto_function)
Definition: locals.cpp:18
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Definition: dstring.h:33