-
Notifications
You must be signed in to change notification settings - Fork 273
Move existing type validation checks to new framework #3147
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
Move existing type validation checks to new framework #3147
Conversation
d297f66
to
d86260c
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: d297f66).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/87671157
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.
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: d86260c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/87673212
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 discussed elsewhere I don't think command-line options are needed for any tool apart from goto-instrument and that only needs one. We should validate on loading (with invariants) and then give the user a way of checking them explicitly via goto-instrument.
|
|
On 1: yes, using .op0() etc. bugs me as well. The plan is to make these protected on exprt, and only allow them on binary_exprt etc., and those that inherit from these classes. I would recommend the following idiom:
b) Then check any subsequent conditions of these operands, using a static cast to unary_exprt, binary_exprt, ternary_exprt, etc., say like this:
After these are done, the type invariants are checked, it's safe to cast to the type! |
Ok, I'll then turn the methods like |
d86260c
to
35691f5
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: 35691f5).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/90557096
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.
35691f5
to
fef7925
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: fef7925).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91092694
return static_cast<const code_typet &>(type); | ||
} | ||
|
||
/// \copydoc to_code_type(const typet &) | ||
inline code_typet &to_code_type(typet &type) | ||
{ | ||
PRECONDITION(can_cast_type<code_typet>(type)); | ||
validate_type(type); |
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.
Shouldn't this get a corresponding check
call?
fef7925
to
4033502
Compare
This removes the validate_type() methods and moves the checks into a new method check() of the corresponding type.
4033502
to
f2dfd2e
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: f2dfd2e).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92381958
This removes the
validate_type()
functions and moves the checks into a new static methodcheck()
of the corresponding type.