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
{
17
ANSI_C_UNKNOWN
,
18
ANSI_C_SYMBOL
,
19
ANSI_C_TYPEDEF
,
20
ANSI_C_TAG
,
21
ANSI_C_LOCAL_LABEL
22
};
23
24
std::ostream &
operator<<
(std::ostream &os,
ansi_c_id_classt
c);
25
26
class
ansi_c_identifiert
27
{
28
public
:
29
ansi_c_id_classt
id_class
;
30
irep_idt
base_name,
prefixed_name
;
31
32
ansi_c_identifiert
():id_class(
ansi_c_id_classt
::
ANSI_C_UNKNOWN
)
33
{
34
}
35
};
36
37
class
ansi_c_scopet
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>
43
name_mapt
;
44
name_mapt
name_map
;
45
46
std::string
prefix
;
47
48
// We remember the last declarator for the benefit
49
// of function argument scoping.
50
irep_idt
last_declarator
;
51
52
// for(;;) and { } scopes are numbered
53
unsigned
compound_counter
;
54
unsigned
anon_counter
;
55
56
ansi_c_scopet
():compound_counter(0), anon_counter(0) { }
57
58
void
swap
(
ansi_c_scopet
&scope)
59
{
60
name_map.swap(scope.
name_map
);
61
prefix.swap(scope.
prefix
);
62
last_declarator.
swap
(scope.
last_declarator
);
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
ansi_c_id_classt::ANSI_C_TYPEDEF
ansi_c_identifiert
Definition:
ansi_c_scope.h:26
ansi_c_id_classt::ANSI_C_UNKNOWN
ansi_c_scopet::name_mapt
std::unordered_map< irep_idt, ansi_c_identifiert, irep_id_hash > name_mapt
Definition:
ansi_c_scope.h:43
ansi_c_scopet
Definition:
ansi_c_scope.h:37
ansi_c_identifiert::id_class
ansi_c_id_classt id_class
Definition:
ansi_c_scope.h:29
ansi_c_scopet::compound_counter
unsigned compound_counter
Definition:
ansi_c_scope.h:53
ansi_c_id_classt
ansi_c_id_classt
Definition:
ansi_c_scope.h:15
operator<<
std::ostream & operator<<(std::ostream &os, ansi_c_id_classt c)
ansi_c_identifiert::ansi_c_identifiert
ansi_c_identifiert()
Definition:
ansi_c_scope.h:32
ansi_c_id_classt::ANSI_C_LOCAL_LABEL
ansi_c_id_classt::ANSI_C_SYMBOL
ansi_c_scopet::swap
void swap(ansi_c_scopet &scope)
Definition:
ansi_c_scope.h:58
dstringt
Definition:
dstring.h:21
ansi_c_scopet::name_map
name_mapt name_map
Definition:
ansi_c_scope.h:44
irep.h
dstringt::swap
void swap(dstringt &b)
Definition:
dstring.h:118
ansi_c_id_classt::ANSI_C_TAG
ansi_c_scopet::ansi_c_scopet
ansi_c_scopet()
Definition:
ansi_c_scope.h:56
ansi_c_scopet::prefix
std::string prefix
Definition:
ansi_c_scope.h:46
ansi_c_identifiert::prefixed_name
irep_idt prefixed_name
Definition:
ansi_c_scope.h:30
ansi_c_scopet::last_declarator
irep_idt last_declarator
Definition:
ansi_c_scope.h:50
ansi_c_scopet::anon_counter
unsigned anon_counter
Definition:
ansi_c_scope.h:54
ansi-c
ansi_c_scope.h
Generated by
1.8.12