22
22
23
23
#include " abstract_object.h"
24
24
25
- /* ******************************************************************\
26
-
27
- Function: abstract_objectt::abstract_objectt
28
-
29
- Inputs:
30
- type - the type the abstract_object is representing
31
-
32
- Outputs:
33
-
34
- Purpose:
35
-
36
- \*******************************************************************/
37
-
25
+ // / Function: abstract_objectt::abstract_objectt
26
+ // /
27
+ // / \param type: the type the abstract_object is representing
38
28
abstract_objectt::abstract_objectt (const typet &type)
39
29
: t(type), bottom(false ), top(true )
40
30
{
41
31
}
42
32
43
- /* ******************************************************************\
44
-
45
- Function: abstract_objectt::abstract_objectt
46
-
47
- Inputs:
48
- type - the type the abstract_object is representing
49
- top - is the abstract_object starting as top
50
- bottom - is the abstract_object starting as bottom
51
-
52
- Outputs:
53
-
54
- Purpose: Start the abstract object at either top or bottom or neither
55
- Asserts if both top and bottom are true
56
-
57
- \*******************************************************************/
58
-
33
+ // / Function: abstract_objectt::abstract_objectt
34
+ // /
35
+ // / \param type: the type the abstract_object is representing
36
+ // / \param top: is the abstract_object starting as top
37
+ // / \param bottom: is the abstract_object starting as bottom
38
+ // /
39
+ // / Start the abstract object at either top or bottom or neither
40
+ // / Asserts if both top and bottom are true
59
41
abstract_objectt::abstract_objectt (const typet &type, bool top, bool bottom)
60
42
: t(type), bottom(bottom), top(top)
61
43
{
@@ -90,57 +72,38 @@ abstract_objectt::abstract_objectt(
90
72
{
91
73
}
92
74
93
- /* ******************************************************************\
94
-
95
- Function: abstract_objectt::type
96
-
97
- Inputs:
98
-
99
- Outputs: The program type this abstract object represents
100
-
101
- Purpose: Get the real type of the variable this abstract object is
102
- representing.
103
-
104
- \*******************************************************************/
75
+ // / Function: abstract_objectt::type
76
+ // /
77
+ // / \return The program type this abstract object represents
78
+ // /
79
+ // / Get the real type of the variable this abstract object is representing.
105
80
const typet &abstract_objectt::type () const
106
81
{
107
82
return t;
108
83
}
109
84
110
- /* ******************************************************************\
111
-
112
- Function: abstract_objectt::merge
113
-
114
- Inputs:
115
- other - The object to merge with this
116
-
117
- Outputs: Returns the result of the merge.
118
-
119
- Purpose: Create a new abstract object that is the result of the merge, unless
120
- the object would be unchanged, then would return itself.
121
-
122
- \*******************************************************************/
123
-
85
+ // / Function: abstract_objectt::merge
86
+ // /
87
+ // / \param other: The object to merge with this
88
+ // /
89
+ // / \return Returns the result of the merge.
90
+ // /
91
+ // / Create a new abstract object that is the result of the merge, unless
92
+ // / the object would be unchanged, then would return itself.
124
93
abstract_object_pointert
125
94
abstract_objectt::merge (abstract_object_pointert other) const
126
95
{
127
96
return abstract_object_merge (other);
128
97
}
129
98
130
- /* ******************************************************************\
131
-
132
- Function: abstract_objectt::abstract_object_merge
133
-
134
- Inputs:
135
- other - The object to merge with this
136
-
137
- Outputs: Returns the result of the abstract object.
138
-
139
- Purpose: Create a new abstract object that is the result of the merge, unless
140
- the object would be unchanged, then would return itself.
141
-
142
- \*******************************************************************/
143
-
99
+ // / Function: abstract_objectt::abstract_object_merge
100
+ // /
101
+ // / \param other: The object to merge with this
102
+ // /
103
+ // / \return Returns the result of the abstract object.
104
+ // /
105
+ // / Create a new abstract object that is the result of the merge, unless
106
+ // / the object would be unchanged, then would return itself.
144
107
abstract_object_pointert abstract_objectt::abstract_object_merge (
145
108
const abstract_object_pointert other) const
146
109
{
@@ -210,22 +173,15 @@ abstract_object_pointert abstract_objectt::abstract_object_meet_internal(
210
173
return shared_from_this ();
211
174
}
212
175
213
- /* ******************************************************************\
214
-
215
- Function: abstract_objectt::expression_transform
216
-
217
- Inputs:
218
- expr - the expression to evaluate and find the result of it. this will
219
- be the symbol referred to be op0()
220
-
221
- Outputs: Returns the abstract_object representing the result of this expression
222
- to the maximum precision available.
223
-
224
- Purpose: To try and resolve different expressions with the maximum level
225
- of precision available.
226
-
227
- \*******************************************************************/
228
-
176
+ // / Function: abstract_objectt::expression_transform
177
+ // /
178
+ // / \param expr: the expression to evaluate and find the result of it. this will
179
+ // / be the symbol referred to be op0()
180
+ // /
181
+ // / \return Returns the abstract_object representing the result of this expression
182
+ // / to the maximum precision available.
183
+ // /
184
+ // / To try and resolve different expressions with the maximum level of precision available.
229
185
abstract_object_pointert abstract_objectt::expression_transform (
230
186
const exprt &expr,
231
187
const std::vector<abstract_object_pointert> &operands,
@@ -304,36 +260,22 @@ abstract_object_pointert abstract_objectt::write(
304
260
return environment.abstract_object_factory (type (), ns, true );
305
261
}
306
262
307
- /* ******************************************************************\
308
-
309
- Function: abstract_objectt::is_top
310
-
311
- Inputs:
312
-
313
- Outputs: Returns true if the abstract object is representing the top (i.e. we
314
- don't know anything about the value).
315
-
316
- Purpose: Find out if the abstract object is top
317
-
318
- \*******************************************************************/
319
-
263
+ // / Function: abstract_objectt::is_top
264
+ // /
265
+ // / \return Returns true if the abstract object is representing the top (i.e. we
266
+ // / don't know anything about the value).
267
+ // /
268
+ // / Find out if the abstract object is top
320
269
bool abstract_objectt::is_top () const
321
270
{
322
271
return top;
323
272
}
324
273
325
- /* ******************************************************************\
326
-
327
- Function: abstract_objectt::is_bottom
328
-
329
- Inputs:
330
-
331
- Outputs: Returns true if the abstract object is representing the bottom.
332
-
333
- Purpose: Find out if the abstract object is bottom
334
-
335
- \*******************************************************************/
336
-
274
+ // / Function: abstract_objectt::is_bottom
275
+ // /
276
+ // / \return Returns true if the abstract object is representing the bottom.
277
+ // /
278
+ // / Find out if the abstract object is bottom
337
279
bool abstract_objectt::is_bottom () const
338
280
{
339
281
return bottom;
@@ -347,43 +289,28 @@ bool abstract_objectt::verify() const
347
289
return !(top && bottom);
348
290
}
349
291
350
- /* ******************************************************************\
351
-
352
- Function: abstract_objectt::to_constant
353
-
354
- Inputs:
355
-
356
- Outputs: Returns an exprt representing the value if the value is known and
357
- constant. Otherwise returns the nil expression
358
-
359
- Purpose: If abstract element represents a single value, then that value,
360
- otherwise nil. E.G. if it is an interval then this will be x if it is
361
- [x,x] This is the (sort of) dual to the constant_exprt constructor
362
- that allows an object to be built from a value.
363
-
364
- \*******************************************************************/
365
-
292
+ // / Function: abstract_objectt::to_constant
293
+ // /
294
+ // / \return Returns an exprt representing the value if the value is known and
295
+ // / constant. Otherwise returns the nil expression
296
+ // /
297
+ // / If abstract element represents a single value, then that value,
298
+ // / otherwise nil. E.G. if it is an interval then this will be x if it is
299
+ // / [x,x] This is the (sort of) dual to the constant_exprt constructor
300
+ // / that allows an object to be built from a value.
366
301
exprt abstract_objectt::to_constant () const
367
302
{
368
303
return nil_exprt ();
369
304
}
370
305
371
- /* ******************************************************************\
372
-
373
- Function: abstract_objectt::output
374
-
375
- Inputs:
376
- out - the stream to write to
377
- ai - the abstract interpreter that contains the abstract domain
378
- (that contains the object ... )
379
- ns - the current namespace
380
-
381
- Outputs:
382
-
383
- Purpose: Print the value of the abstract object
384
-
385
- \*******************************************************************/
386
-
306
+ // / Function: abstract_objectt::output
307
+ // /
308
+ // / \param out: the stream to write to
309
+ // / \param ai: the abstract interpreter that contains the abstract domain
310
+ // / (that contains the object ... )
311
+ // / \param ns: the current namespace
312
+ // /
313
+ // / Print the value of the abstract object
387
314
void abstract_objectt::output (
388
315
std::ostream &out,
389
316
const ai_baset &ai,
@@ -403,25 +330,18 @@ void abstract_objectt::output(
403
330
}
404
331
}
405
332
406
- /* ******************************************************************\
407
-
408
- Function: abstract_objectt::merge
409
-
410
- Inputs:
411
- op1 - the first abstract object to merge, this object determines
412
- the sensitivity of the output and is the object compared against
413
- to choose whether this merge changed anything
414
- op2 - the second abstract object to merge
415
-
416
- Outputs: The merged abstract object with the same sensitivity as the
417
- first parameter. out_modifications will be true if the resulting
418
- abstract object is different from op1
419
-
420
- Purpose: Clones the first parameter and merges it with the second.
421
-
422
-
423
- \*******************************************************************/
424
-
333
+ // / Function: abstract_objectt::merge
334
+ // /
335
+ // / \param op1: the first abstract object to merge, this object determines
336
+ // / the sensitivity of the output and is the object compared against
337
+ // / to choose whether this merge changed anything
338
+ // / \param op2: the second abstract object to merge
339
+ // /
340
+ // / \return The merged abstract object with the same sensitivity as the
341
+ // / first parameter. out_modifications will be true if the resulting
342
+ // / abstract object is different from op1
343
+ // /
344
+ // / Clones the first parameter and merges it with the second.
425
345
abstract_object_pointert abstract_objectt::merge (
426
346
abstract_object_pointert op1,
427
347
abstract_object_pointert op2,
@@ -436,20 +356,14 @@ abstract_object_pointert abstract_objectt::merge(
436
356
return result;
437
357
}
438
358
439
- /* ******************************************************************\
440
-
441
- Function: abstract_objectt::should_use_base_merge
442
-
443
- Inputs:
444
- other - the object being merged with
445
-
446
- Outputs: Returns true if the base class is capable of doing a complete merge
447
-
448
- Purpose: To detect the cases where the base merge is sufficient to do a merge
449
- We can't do if this->is_bottom() since we want the specific
450
-
451
- \*******************************************************************/
452
-
359
+ // / Function: abstract_objectt::should_use_base_merge
360
+ // /
361
+ // / \param other: the object being merged with
362
+ // /
363
+ // / \return Returns true if the base class is capable of doing a complete merge
364
+ // /
365
+ // / To detect the cases where the base merge is sufficient to do a merge
366
+ // / We can't do if this->is_bottom() since we want the specific
453
367
bool abstract_objectt::should_use_base_merge (
454
368
const abstract_object_pointert other) const
455
369
{
0 commit comments