CBMC
ansi_c_scope.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_ANSI_C_ANSI_C_SCOPE_H
11 #define CPROVER_ANSI_C_ANSI_C_SCOPE_H
12 
13 #include <util/irep.h>
14 
15 #include <unordered_map>
16 
17 enum class ansi_c_id_classt
18 {
22  ANSI_C_TAG,
24 };
25 
26 std::ostream &operator<<(std::ostream &os, ansi_c_id_classt c);
27 
29 {
30 public:
33 
35  {
36  }
37 };
38 
40 {
41 public:
42  // This maps "scope names" (tag-X, label-X, X) to
43  // ansi_c_identifiert.
44  typedef std::unordered_map<irep_idt, ansi_c_identifiert> name_mapt;
46 
47  std::string prefix;
48 
49  // We remember the last declarator for the benefit
50  // of function argument scoping.
52 
53  // for(;;) and { } scopes are numbered
54  unsigned compound_counter;
55  unsigned anon_counter;
56 
58 
59  void swap(ansi_c_scopet &scope)
60  {
61  name_map.swap(scope.name_map);
62  prefix.swap(scope.prefix);
64  std::swap(compound_counter, scope.compound_counter);
65  }
66 
67  void print(std::ostream &out) const;
68 };
69 
70 #endif // CPROVER_ANSI_C_ANSI_C_SCOPE_H
std::ostream & operator<<(std::ostream &os, ansi_c_id_classt c)
ansi_c_id_classt
Definition: ansi_c_scope.h:18
ansi_c_id_classt id_class
Definition: ansi_c_scope.h:31
irep_idt prefixed_name
Definition: ansi_c_scope.h:32
unsigned anon_counter
Definition: ansi_c_scope.h:55
void print(std::ostream &out) const
void swap(ansi_c_scopet &scope)
Definition: ansi_c_scope.h:59
std::string prefix
Definition: ansi_c_scope.h:47
name_mapt name_map
Definition: ansi_c_scope.h:45
std::unordered_map< irep_idt, ansi_c_identifiert > name_mapt
Definition: ansi_c_scope.h:44
unsigned compound_counter
Definition: ansi_c_scope.h:54
irep_idt last_declarator
Definition: ansi_c_scope.h:51
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
void swap(dstringt &b)
Definition: dstring.h:162