cprover
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 enum class ansi_c_id_classt
16 {
20  ANSI_C_TAG,
22 };
23 
24 std::ostream &operator<<(std::ostream &os, ansi_c_id_classt c);
25 
27 {
28 public:
31 
33  {
34  }
35 };
36 
38 {
39 public:
40  // This maps "scope names" (tag-X, label-X, X) to
41  // ansi_c_identifiert.
42  typedef std::unordered_map<irep_idt, ansi_c_identifiert, irep_id_hash>
45 
46  std::string prefix;
47 
48  // We remember the last declarator for the benefit
49  // of function argument scoping.
51 
52  // for(;;) and { } scopes are numbered
53  unsigned compound_counter;
54  unsigned anon_counter;
55 
57 
58  void swap(ansi_c_scopet &scope)
59  {
60  name_map.swap(scope.name_map);
61  prefix.swap(scope.prefix);
63  std::swap(compound_counter, scope.compound_counter);
64  }
65 
66  void print(std::ostream &out) const;
67 };
68 
69 #endif // CPROVER_ANSI_C_ANSI_C_SCOPE_H
std::unordered_map< irep_idt, ansi_c_identifiert, irep_id_hash > name_mapt
Definition: ansi_c_scope.h:43
void print(std::ostream &out) const
ansi_c_id_classt id_class
Definition: ansi_c_scope.h:29
unsigned compound_counter
Definition: ansi_c_scope.h:53
ansi_c_id_classt
Definition: ansi_c_scope.h:15
std::ostream & operator<<(std::ostream &os, ansi_c_id_classt c)
void swap(ansi_c_scopet &scope)
Definition: ansi_c_scope.h:58
name_mapt name_map
Definition: ansi_c_scope.h:44
void swap(dstringt &b)
Definition: dstring.h:118
std::string prefix
Definition: ansi_c_scope.h:46
irep_idt prefixed_name
Definition: ansi_c_scope.h:30
irep_idt last_declarator
Definition: ansi_c_scope.h:50
unsigned anon_counter
Definition: ansi_c_scope.h:54