1
1
/* ******************************************************************\
2
2
3
- Module:
3
+ Module: Defines typet, type_with_subtypet and type_with_subtypest
4
4
5
5
Author: Daniel Kroening, [email protected]
6
+ Maria Svorenova, [email protected]
6
7
7
8
\*******************************************************************/
8
9
10
+ // / \file
11
+ // / Defines typet, type_with_subtypet and type_with_subtypest
9
12
10
13
#ifndef CPROVER_UTIL_TYPE_H
11
14
#define CPROVER_UTIL_TYPE_H
17
20
18
21
class namespacet ;
19
22
20
- /* ! \brief The type of an expression
21
- */
23
+ // / The type of an expression, extends irept. Types may have subtypes. This is
24
+ // / modeled with two subs named “subtype” (a single type) and “subtypes”
25
+ // / (a vector of types). The class typet only adds specialized methods
26
+ // / for accessing the subtype information to the interface of irept.
27
+ // / For pre-defined types see `std_types.h`.
22
28
class typet :public irept
23
29
{
24
30
public:
@@ -90,7 +96,7 @@ class typet:public irept
90
96
{ remove (ID_subtype); }
91
97
#endif
92
98
93
- void move_to_subtypes (typet &type); // destroys expr
99
+ void move_to_subtypes (typet &type);
94
100
95
101
void copy_to_subtypes (const typet &type);
96
102
@@ -115,6 +121,7 @@ class typet:public irept
115
121
}
116
122
};
117
123
124
+ // / Type with a single subtype.
118
125
class type_with_subtypet :public typet
119
126
{
120
127
public:
@@ -136,6 +143,7 @@ class type_with_subtypet:public typet
136
143
#endif
137
144
};
138
145
146
+ // / Type with multiple subtypes.
139
147
class type_with_subtypest :public typet
140
148
{
141
149
public:
@@ -169,43 +177,8 @@ class type_with_subtypest:public typet
169
177
for (typet::subtypest::iterator it=(type).subtypes().begin(); \
170
178
it!=(type).subtypes().end(); ++it)
171
179
172
- /*
173
-
174
- pre-defined types:
175
- universe // super type
176
- type // another type
177
- predicate // predicate expression (subtype and predicate)
178
- uninterpreted // uninterpreted type with identifier
179
- empty // void
180
- bool // true or false
181
- abstract // abstract super type
182
- struct // with components: each component has name and type
183
- // the ordering matters
184
- rational
185
- real
186
- integer
187
- complex
188
- string
189
- enum // with elements
190
- // the ordering does not matter
191
- tuple // with components: each component has type
192
- // the ordering matters
193
- mapping // domain -> range
194
- bv // no interpretation
195
- unsignedbv
196
- signedbv // two's complement
197
- floatbv // IEEE floating point format
198
- code
199
- pointer // for ANSI-C (subtype)
200
- symbol // look in symbol table (identifier)
201
- number // generic number super type
202
-
203
- */
204
-
205
180
bool is_number (const typet &type);
206
- // rational, real, integer, complex, unsignedbv, signedbv, floatbv
207
181
208
- // Is the passed in type const qualified?
209
182
bool is_constant_or_has_constant_components (
210
183
const typet &type,
211
184
const namespacet &ns);
0 commit comments