Skip to content

Commit 8595305

Browse files
author
martin
committed
Convert comments to the new(er) doxygen format
1 parent 600ae17 commit 8595305

31 files changed

+978
-1633
lines changed

src/analyses/variable-sensitivity/abstract_enviroment.cpp

+158-272
Large diffs are not rendered by default.

src/analyses/variable-sensitivity/abstract_enviroment.h

+12-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
77
\*******************************************************************/
88

9+
/// \file
10+
/// An abstract version of a program environment. Each variable has
11+
/// an abstract object rather than a value. If these are top then
12+
/// they are not explicitly stored so that the memory used is
13+
/// proportional to what is known rather than just the number of
14+
/// variables.
15+
/// Note the use of sharing_mapt is critical for scalability.
16+
917
#ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H
1018
#define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H
1119

@@ -25,7 +33,7 @@ class abstract_environmentt
2533
public:
2634
using map_keyt = irep_idt;
2735
abstract_environmentt();
28-
// These three are really the heart of the method
36+
/// These three are really the heart of the method
2937
virtual abstract_object_pointert
3038
eval(const exprt &expr, const namespacet &ns) const;
3139
virtual bool assign(
@@ -57,9 +65,9 @@ class abstract_environmentt
5765

5866
virtual bool merge(const abstract_environmentt &env);
5967

60-
// This should be used as a default case / everything else has failed
61-
// The string is so that I can easily find and diagnose cases where this
62-
// occurs
68+
/// This should be used as a default case / everything else has failed
69+
/// The string is so that I can easily find and diagnose cases where this
70+
/// occurs
6371
virtual void havoc(const std::string &havoc_string);
6472

6573
void make_top();

src/analyses/variable-sensitivity/abstract_object.cpp

+89-175
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,22 @@
2222

2323
#include "abstract_object.h"
2424

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
3828
abstract_objectt::abstract_objectt(const typet &type)
3929
: t(type), bottom(false), top(true)
4030
{
4131
}
4232

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
5941
abstract_objectt::abstract_objectt(const typet &type, bool top, bool bottom)
6042
: t(type), bottom(bottom), top(top)
6143
{
@@ -90,57 +72,38 @@ abstract_objectt::abstract_objectt(
9072
{
9173
}
9274

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.
10580
const typet &abstract_objectt::type() const
10681
{
10782
return t;
10883
}
10984

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.
12493
abstract_object_pointert
12594
abstract_objectt::merge(abstract_object_pointert other) const
12695
{
12796
return abstract_object_merge(other);
12897
}
12998

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.
144107
abstract_object_pointert abstract_objectt::abstract_object_merge(
145108
const abstract_object_pointert other) const
146109
{
@@ -210,22 +173,15 @@ abstract_object_pointert abstract_objectt::abstract_object_meet_internal(
210173
return shared_from_this();
211174
}
212175

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.
229185
abstract_object_pointert abstract_objectt::expression_transform(
230186
const exprt &expr,
231187
const std::vector<abstract_object_pointert> &operands,
@@ -304,36 +260,22 @@ abstract_object_pointert abstract_objectt::write(
304260
return environment.abstract_object_factory(type(), ns, true);
305261
}
306262

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
320269
bool abstract_objectt::is_top() const
321270
{
322271
return top;
323272
}
324273

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
337279
bool abstract_objectt::is_bottom() const
338280
{
339281
return bottom;
@@ -347,43 +289,28 @@ bool abstract_objectt::verify() const
347289
return !(top && bottom);
348290
}
349291

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.
366301
exprt abstract_objectt::to_constant() const
367302
{
368303
return nil_exprt();
369304
}
370305

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
387314
void abstract_objectt::output(
388315
std::ostream &out,
389316
const ai_baset &ai,
@@ -403,25 +330,18 @@ void abstract_objectt::output(
403330
}
404331
}
405332

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.
425345
abstract_object_pointert abstract_objectt::merge(
426346
abstract_object_pointert op1,
427347
abstract_object_pointert op2,
@@ -436,20 +356,14 @@ abstract_object_pointert abstract_objectt::merge(
436356
return result;
437357
}
438358

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
453367
bool abstract_objectt::should_use_base_merge(
454368
const abstract_object_pointert other) const
455369
{

0 commit comments

Comments
 (0)