-
Notifications
You must be signed in to change notification settings - Fork 274
Clean_up related to symex_assign_symbol #4793
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
Clean_up related to symex_assign_symbol #4793
Conversation
e856514
to
9f408f3
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: bc044d9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/115563600
Codecov Report
@@ Coverage Diff @@
## develop #4793 +/- ##
==========================================
Coverage ? 68.65%
==========================================
Files ? 1281
Lines ? 105583
Branches ? 0
==========================================
Hits ? 72492
Misses ? 33091
Partials ? 0
Continue to review full report at Codecov.
|
src/goto-symex/symex_assign.cpp
Outdated
} | ||
return state.rename(std::move(guarded_rhs), ns).get(); | ||
}(); | ||
guard.empty() ? rhs : (exprt)if_exprt{conjunction(guard), rhs, lhs}, ns) |
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'd prefer static_cast<exprt>
as the C-style cast is just very easy to overlook.
src/goto-symex/ssa_step.cpp
Outdated
@@ -231,7 +230,7 @@ SSA_assignment_stept::SSA_assignment_stept( | |||
original_full_lhs = std::move(_original_full_lhs); | |||
ssa_rhs = std::move(_ssa_rhs); | |||
assignment_type = _assignment_type; | |||
cond_expr = std::move(_cond_expr); | |||
cond_expr = equal_exprt(ssa_lhs, ssa_rhs); |
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.
Nit pick: use curly braces
const exprt assignment_guard = | ||
make_and(state.guard.as_expr(), conjunction(guard)); | ||
|
||
const exprt original_lhs = get_original_name(l2_full_lhs); | ||
target.assignment( |
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.
Random place: typo in the commit message: "this values" -> "these values", and also it should be "Inline variables" (plural)
src/goto-symex/goto_state.cpp
Outdated
{ | ||
level2.current_names.insert(l1_identifier, std::make_pair(lhs, n)); | ||
std::pair<ssa_exprt, unsigned> copy = r_opt->get(); | ||
copy.second = narrow<unsigned>(n); |
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.
Ack, but we should really stop using unsigned
, the renaming index ought to be std::size_t
.
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.
@tautschnig I added that change in a new commit
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.
Thank you!
@@ -217,7 +217,7 @@ class goto_symex_statet final : public goto_statet | |||
unsigned remaining_vccs = 0; | |||
|
|||
/// Allocates a fresh L2 name for the given L1 identifier, and makes it the | |||
// latest generation on this path. | |||
/// latest generation on this path. |
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.
Note on the commit message: that's a "slash", not a "backslash"
980910b
to
5e22d89
Compare
This intermediary variable doesn't help understanding and slows down reading the code.
Makes it clearer why it is declared.
ns.lookup doesn't do the assignment
The definition of this reference is not useful.
We can deduce it from the assignment type rather than having to give it to the constructor.
This can be deduced fro lhs and rhs without having to give it to the constructor.
Declaring variables for these values doesn't add clarity and makes the function longer.
Add missing const, necessary narrow and insert if and else to make r_opt scoped to only the if branch.
No functional changes. Necessary for doxygen comment
This is necessary for CI
This avoids some conversions, in particular when assigning from the return value of fresh_l2_name_provider.
5e22d89
to
71caf32
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: 71caf32).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/115789758
There is no functional changes, this is just aimed at making the code a bit simpler