-
Notifications
You must be signed in to change notification settings - Fork 274
Group symex options into symex_config structure #3431
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
Group symex options into symex_config structure #3431
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 936fd9c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91653597
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.
The more typed options, the better.
src/goto-symex/goto_symex.h
Outdated
@@ -38,6 +38,35 @@ class namespacet; | |||
class side_effect_exprt; | |||
class typecast_exprt; | |||
|
|||
/// Configuration of the symbolic execution | |||
struct symex_configt |
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.
⛏ You might've forgotten final
.
src/goto-symex/goto_symex.h
Outdated
bool partial_loops; | ||
std::string debug_level; | ||
|
||
explicit symex_configt(const optionst &options) |
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 can never decide whether parsing (or doing any operation that can fail) in the constructor is a good or bad idea. I wonder what happens when an option is not specified.
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 could have a non-member symex_configt symex_config(const optionst &)
function instead. Will try that.
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.
Making it a separate function only makes sense if the function can return an empty optional as an error for instance (constructors cannot return empty optionals).
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.
The result of that is required for the goto_symext constructor anyway so using optional just there wouldn't solve the problem. I would suggest making the goto_symext
constructor take a symex_configt
instead.
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.
Actually get_option functions have default for when the option is not specified (0 for int, "" for string) so we can go back to using a constructor and there is no reason for it to fail.
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.
Not a fan of silent failures, but this seems to be a subject for another time.
9745c58
to
bf24482
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: bf24482).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91678677
@@ -458,7 +458,7 @@ void goto_symext::symex_trace( | |||
{ | |||
PRECONDITION(code.arguments().size() >= 2); | |||
|
|||
int debug_thresh = unsafe_string2int(debug_level); | |||
int debug_thresh = unsafe_string2int(symex_config.debug_level); |
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.
Why not parse that right away?
The benefit of this is not obvious, but I'm not strictly opposed. |
bf24482
to
7de2106
Compare
The benefits I see are that it simplifies the goto_symext class; it makes obvious in the code that a field comes from the configuration and thus is constant (they will all start with |
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: 7de2106).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91842803
7de2106
to
1dec39c
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: 1dec39c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91894990
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.
Seems like a very good idea. Just a nit pick: there is a typo in the commit message: s/Pares/Parse/
This makes it easy to separate the constant parameters of that class from the other fields.
No functional change
1dec39c
to
bf8e58b
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: bf8e58b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92545158
This makes it easy to separate the constant parameters of that class
from the other fields.