Skip to content

Commit 79c7f6c

Browse files
NlightNFotisEnrico Steffinlongo
authored and
Enrico Steffinlongo
committed
More documentation of functions in shadow_memory_util.h
1 parent fa920a3 commit 79c7f6c

File tree

2 files changed

+26
-15
lines changed

2 files changed

+26
-15
lines changed

src/goto-symex/shadow_memory_util.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,20 +348,19 @@ static void or_elements(
348348
}
349349
}
350350

351-
/// Translate a list of values into an or expression. Used here in the implementation
352-
/// of aggregation of boolean-typed fields.
353-
/// \param field_type The type of the values of the or expression (expected to be
354-
/// the same).
351+
/// Translate a list of values into an or expression. Used here in the
352+
/// implementation of aggregation of boolean-typed fields.
353+
/// \param field_type The type of the values of the or expression (expected to
354+
/// be the same).
355355
/// \param values A list (std::vector) of values collected previously, passed
356-
/// through immediatelly to the constructed expression as operands.
356+
/// through immediately to the constructed expression as operands.
357357
/// \return A newly constructed or_exprt over the possible values given.
358358
static exprt or_values(const exprt::operandst &values, const typet &field_type)
359359
{
360360
if(values.size() == 1)
361361
{
362362
return values[0];
363363
}
364-
// TODO: FOTIS: Just `or_exprt`?
365364
return multi_ary_exprt(ID_bitor, values, field_type);
366365
}
367366

src/goto-symex/shadow_memory_util.h

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ void log_value_set(
6464
const messaget &log,
6565
const std::vector<exprt> &value_set);
6666

67-
/// Log a match between a value in the value set of a given expression, and
67+
/// Log a match between an address and a value the value set. This version of
68+
/// the function reports more details, including the base address, the pointer
69+
/// and the shadow value.
6870
void log_value_set_match(
6971
const namespacet &ns,
7072
const messaget &log,
@@ -74,7 +76,7 @@ void log_value_set_match(
7476
const exprt &expr,
7577
const value_set_dereferencet::valuet &shadow_dereference);
7678

77-
// TODO: doxygen
79+
/// Logs a successful match between an address and a value within the value set.
7880
void log_value_set_match(
7981
const namespacet &ns,
8082
const messaget &log,
@@ -87,17 +89,27 @@ void log_try_shadow_address(
8789
const messaget &log,
8890
const shadow_memory_statet::shadowed_addresst &shadowed_address);
8991

90-
// TODO: doxygen
92+
/// Generic logging function that will log depending on the configured
93+
/// verbosity. Will log a specific message given to it, along with an expression
94+
/// passed along to it.
9195
void log_cond(
9296
const namespacet &ns,
9397
const messaget &log,
9498
const char *cond_text,
9599
const exprt &cond);
96100

97-
// TODO: doxygen
101+
/// Replace an invalid object by a null pointer. Works recursively on the
102+
/// operands (child nodes) of the expression, as well.
103+
/// \param expr The (root) expression where substitution will happen.
98104
void replace_invalid_object_by_null(exprt &expr);
99105

100-
// TODO: doxygen
106+
/// Retrieve the expression that a field was initialised with within a given
107+
/// symex state.
108+
/// \param field_name The field whose initialisation expression we want to
109+
/// retrieve.
110+
/// \param state The goto symex state within which we want to search for the
111+
/// expression.
112+
/// \returns The expression the field was initialised with.
101113
const exprt &
102114
get_field_init_expr(const irep_idt &field_name, const goto_symex_statet &state);
103115

@@ -155,7 +167,7 @@ exprt compute_max_over_cells(
155167
/// \param conds_values Contains pairs <e1, e2>, where `e1` is going to be
156168
/// used as an antecedent for an if_expr, and `e2` is going to be used
157169
/// as the consequent.
158-
/// \returns An if_exprt of the form `if e1 then e2 else <if e3 then e4 else ...`
170+
/// \returns An if_exprt of the form `if e1 then e2 else if e3 then e4 else ...`
159171
exprt build_if_else_expr(
160172
const std::vector<std::pair<exprt, exprt>> &conds_values);
161173

@@ -170,9 +182,9 @@ bool set_field_check_null(
170182
/// Get shadow memory values for a given expression within a specified value
171183
/// set.
172184
/// \returns if potential values are present for that object inside the value
173-
/// set, then we get back an `if e1 then e2 else (if e3 else e4...` expression,
174-
/// where `e1`, `e3`, ... are guards (conditions) and `e2`, `e4`, etc are
175-
/// the possible values of the object within the value set.
185+
/// set, then we get back an `if e1 then e2 else (if e3 else e4...`
186+
/// expression, where `e1`, `e3`, ... are guards (conditions) and `e2`, `e4`,
187+
/// etc are the possible values of the object within the value set.
176188
optionalt<exprt> get_shadow_memory(
177189
const exprt &expr,
178190
const std::vector<exprt> &value_set,

0 commit comments

Comments
 (0)