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:
23 
24  explicit localst(const goto_functiont &goto_function)
25  {
26  build(goto_function);
27  }
28 
29  void output(std::ostream &out) const;
30 
31  // Returns true for all procedure-local variables,
32  // not including those with static storage duration,
33  // but including the function parameters.
34  bool is_local(const irep_idt &identifier) const
35  {
36  return locals_map.find(identifier)!=locals_map.end();
37  }
38 
39  typedef std::map<irep_idt, symbol_exprt> locals_mapt;
40  locals_mapt locals_map;
41 
42 protected:
43  void build(const goto_functiont &goto_function);
44 };
45 
46 inline std::ostream &operator<<(
47  std::ostream &out, const localst &locals)
48 {
49  locals.output(out);
50  return out;
51 }
52 
53 #endif // CPROVER_ANALYSES_LOCALS_H
localst(const goto_functiont &goto_function)
Definition: locals.h:24
locals_mapt locals_map
Definition: locals.h:40
Goto Programs with Functions.
Definition: locals.h:19
std::ostream & operator<<(std::ostream &out, const localst &locals)
Definition: locals.h:46
std::map< irep_idt, symbol_exprt > locals_mapt
Definition: locals.h:39
bool is_local(const irep_idt &identifier) const
Definition: locals.h:34
goto_functionst::goto_functiont goto_functiont
Definition: locals.h:22
void output(std::ostream &out) const
Definition: locals.cpp:33
void build(const goto_functiont &goto_function)
Definition: locals.cpp:18
goto_function_templatet< goto_programt > goto_functiont