-
Notifications
You must be signed in to change notification settings - Fork 277
Class and function documentation for goto-symex-target [DOC-79] #3393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, a lot of useful docs added! I have mostly minor suggestions for formatting (sorry for all the fruits 🙂 first I wanted to mark all the places for the recurring comments with them but it's too much), here is a summary:
- use imperative mood in function docs,
- indent the overflowing lines by two spaces for better readability,
- move docs of interface functions to headers,
- I would suggest calling the
guard
s preconditions and reformulating the sentence a bit (see 🍓).
There are few other comments but nothing too big.
/// \param guard: condition to take this read event | ||
/// \param ssa_rhs: variable to be read from | ||
/// \param atomic_section_id: ID of the atomic section in which this read | ||
/// takes place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ Indent by 2 spaces for better readability. 🍌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, and hopefully all the bananas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think only one space is added now but that's probably enough 🙂 (maybe you ran into the same mistake I sometimes make - hitting tab right after the ///
results in adding one space only but hitting tab at the place where text starts one space after the ///
indents by 2 spaces then)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: c0b43da).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91244044
src/goto-symex/symex_assign.cpp
Outdated
@@ -91,6 +91,11 @@ void goto_symext::symex_assign( | |||
} | |||
} | |||
|
|||
/// Store the \c what expression as the first unassigned 0th operand of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally find what
easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using \p
to also make clear this refers to a parameter (and not just some arbitrary code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (throughout the PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A swapped backslash-c with back-ticks throughout the PR.
src/goto-symex/symex_assign.cpp
Outdated
@@ -91,6 +91,11 @@ void goto_symext::symex_assign( | |||
} | |||
} | |||
|
|||
/// Store the \c what expression as the first unassigned 0th operand of the | |||
/// \c lhs. | |||
/// \param lhs non-symbol pointed-to expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lhs: Non-...
according to coding style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, here and elsewhere.
src/goto-symex/symex_assign.cpp
Outdated
/// \c lhs. | ||
/// \param lhs non-symbol pointed-to expression | ||
/// \param what the expression to be added to the \c lhs | ||
/// \return the resulting expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\return The...
according to coding style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also done.
src/goto-symex/symex_target.h
Outdated
/// \param guard: condition to take this read event | ||
/// \param ssa_rhs: variable to be read from | ||
/// \param atomic_section_id: ID of the atomic section in which this read | ||
/// takes place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would increase readability to indent here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/goto-symex/symex_assign.cpp
Outdated
@@ -91,6 +91,11 @@ void goto_symext::symex_assign( | |||
} | |||
} | |||
|
|||
/// Store the \c what expression as the first unassigned 0th operand of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using \p
to also make clear this refers to a parameter (and not just some arbitrary code)?
src/goto-symex/symex_target.h
Outdated
@@ -17,6 +17,9 @@ Author: Daniel Kroening, [email protected] | |||
class ssa_exprt; | |||
class symbol_exprt; | |||
|
|||
/// Base class for symbolic execution. Intended as a position identifier in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a "position identifier?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure if we have an established term to refer to program location. To the best of my understanding symex_targett
has a similar purpose to const_target
which is an iterator into a list of instructions. I tried rewording the description a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, actually a symex_targett
is very different (although by now I'm not even sure it is a meaningful interface anymore, because we leak out symex_target_equationt
all over the place). A symex_targett
is the interface of the target container for symbolic execution to record its symbolic steps into. As far as I am aware, symex_target_equationt
is the only implementation of that interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you won't mind if I quote/paraphrase the above for the description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symex_target_equationt
is the only implementation of that interface.
Yes, afaik.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: c3b447b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91500113
I think I've addressed all the @svorenova @peterschrammel and @tautschnig comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go, I just have one question about four functions without doc. But because this is already much better than what it was before I won't block the merge.
/// \param cond: Condition represented by this constraint | ||
/// \param msg: The message associated with this constraint | ||
/// \param source: Pointer to location in the input GOTO program of this | ||
/// constraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I asked this before but it may have gotten lost - why are the last four functions below not documented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: 7d77198).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91549113
@xbauch, can you squash the commits please? |
7d77198
to
fffc954
Compare
Squashed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: fffc954).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91638896
fffc954
to
e399467
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: e399467).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93174124
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
@xbauch Could you please rebase to make sure the bot is re-triggered as the past failure was likely caused by unrelated problems? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of suggestions and requests for changes below, but nothing blocking. The biggest item is using \copydoc
to avoid duplicating the same text when functions are just implementations of an interface. In those cases please make sure the documentation genuinely was the same, else merge any missing bits into the documentation of the interface.
src/goto-symex/goto_symex.h
Outdated
/// Store the \p what expression as the first unassigned 0th operand of the | ||
/// \p lhs. | ||
/// \param lhs: Non-symbol pointed-to expression | ||
/// \param what: The expression to be added to the \c lhs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// \param what: The expression to be added to the \c lhs | |
/// \param what: The expression to be added to the \p lhs |
src/goto-symex/goto_symex.h
Outdated
@@ -391,6 +391,11 @@ class goto_symext | |||
guardt &, | |||
assignment_typet); | |||
|
|||
/// Store the \p what expression as the first unassigned 0th operand of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is an "unassigned" operand?
src/goto-symex/symex_target.h
Outdated
@@ -17,6 +17,9 @@ Author: Daniel Kroening, [email protected] | |||
class ssa_exprt; | |||
class symbol_exprt; | |||
|
|||
/// The interface of the target _container_ for symbolic execution to record its | |||
/// symbolic steps into. Presently, symex_target_equationt is the only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// symbolic steps into. Presently, symex_target_equationt is the only | |
/// symbolic steps into. Presently, \ref symex_target_equationt is the only |
@@ -26,6 +29,9 @@ class symex_targett | |||
|
|||
virtual ~symex_targett() { } | |||
|
|||
/// Identifies source in the context of symbolic execution. Thread number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have to rethink the naming here - this really is a generalisation of the program counter with some additional context. But that's not for this PR.
src/goto-symex/symex_target.h
Outdated
@@ -65,21 +71,46 @@ class symex_targett | |||
GUARD, | |||
}; | |||
|
|||
// read event | |||
/// Read from a shared variable `ssa_rhs` (which will thus become a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Read from a shared variable `ssa_rhs` (which will thus become a | |
/// Read from a shared variable \p ssa_rhs (which will thus become a |
src/goto-symex/symex_target.h
Outdated
/// \param guard: Precondition for this read event | ||
/// \param ssa_rhs: Variable to be read from | ||
/// \param atomic_section_id: ID of the atomic section in which this read | ||
/// takes place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// takes place | |
/// takes place (if any) |
src/goto-symex/symex_target.h
Outdated
virtual void shared_read( | ||
const exprt &guard, | ||
const ssa_exprt &ssa_rhs, | ||
unsigned atomic_section_id, | ||
const sourcet &source)=0; | ||
|
||
// write event | ||
/// Write to a shared variable `ssa_rhs` (which will thus become a | ||
/// left-hand side as well): we effectively assign a value from this thread |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is done in the implementation, please rename "ssa_rhs" to "ssa_object" and then remove the parts in parentheses - this always was a left-hand side, it's not actually becoming one here.
src/goto-symex/symex_target.h
Outdated
/// \param guard: Precondition for this write event | ||
/// \param ssa_rhs: Variable to be written to | ||
/// \param atomic_section_id: ID of the atomic section in which this write | ||
/// takes place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// takes place | |
/// takes place (if any) |
@@ -29,26 +29,55 @@ class decision_proceduret; | |||
class namespacet; | |||
class prop_convt; | |||
|
|||
/// Inheriting the interface of symex_targett this class represents the SSA | |||
/// form of the input program as a list of SSA_stept. It further extends the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// form of the input program as a list of SSA_stept. It further extends the | |
/// form of the input program as a list of \ref SSA_stept. It further extends the |
/// \param ssa_object: Variable to be read from | ||
/// \param atomic_section_id: ID of the atomic section in which this read | ||
/// takes place | ||
/// \param source: Pointer to location in the input GOTO program of this read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below: use \copydoc
e399467
to
cf97e60
Compare
1) Document the symex_target interface. 2) Document the symex_target_equation -- Mostly SSA_stept and the transformations into it.
cf97e60
to
bff5bf4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
Passed Diffblue compatibility checks (cbmc commit: bff5bf4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/93351125
Adding class and function documentation to goto-symex/symex_target. {h,cpp} and goto-symex/symex_target_equation.{h,cpp}.