-
Notifications
You must be signed in to change notification settings - Fork 285
exprt::opX cleanup #3465
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
exprt::opX cleanup #3465
Conversation
kroening
commented
Nov 26, 2018
- Each commit message has a non-empty body, explaining why the change was made.
- n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
- Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
- n/a My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.
a991544 to
b39c559
Compare
src/goto-symex/slice_by_trace.cpp
Outdated
| u_rhs.copy_to_operands(guard); | ||
| u_rhs.copy_to_operands(merge[j]); | ||
| u_rhs.op0().make_not(); | ||
| u_rhs.add_to_operands(not_exprt(guard), merge[j]); |
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.
make_not is slightly different to this one - maybe use boolean_negate 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.
done
| if( | ||
| to_bitvector_type(typecast_expr.type()).get_width() >= | ||
| to_bitvector_type(typecast_expr.op().type()).get_width()) | ||
| return build_string(typecast_expr.op()); |
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: please add braces for 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
| if(expr.type().id()==ID_signedbv || | ||
| expr.type().id()==ID_unsignedbv) | ||
| if( | ||
| typecast_expr.type().id() == ID_signedbv || |
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.
Suggestion that I shouldn't be making because out-of-scope for this PR: we use typecast_expr.type().id() and typecast_expr.op().type().id() several times in here, maybe add some temporaries?
src/analyses/invariant_set.cpp
Outdated
| { | ||
| assert(expr.operands().size()==1); | ||
| return build_string(expr.op0())+"."+expr.get_string(ID_component_name); | ||
| return build_string(to_member_expr(expr).struct_op()) + "." + |
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 believe .struct_op() is deprecated in favour of .compound() (here and below).
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/analyses/invariant_set.cpp
Outdated
| { | ||
| assert(expr.op1().operands().size()==1); | ||
| add_type_bounds(expr.op0(), expr.op1().op0().type()); | ||
| assert(equal_expr.op1().operands().size() == 1); |
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 can safely get rid of this by using to_typecast_expr below. Repeats once more below.
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.
That would also get rid of the use of assert rather than INVARIANT too....
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
| get_object(expr.op1(), p.second)) | ||
| if( | ||
| get_object(equal_expr.op0(), p.first) || | ||
| get_object(equal_expr.op1(), p.second)) |
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: please add braces for 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
| get_object(expr.op1(), p.second)) | ||
| if( | ||
| get_object(notequal_expr.op0(), p.first) || | ||
| get_object(notequal_expr.op1(), p.second)) |
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: please add braces for 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
chrisr-diffblue
left a comment
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 agree with the comments Michael made, but otherwise looks like a nice cleanup to me.
src/analyses/invariant_set.cpp
Outdated
| { | ||
| assert(expr.op1().operands().size()==1); | ||
| add_type_bounds(expr.op0(), expr.op1().op0().type()); | ||
| assert(equal_expr.op1().operands().size() == 1); |
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.
That would also get rid of the use of assert rather than INVARIANT too....
133bdb3 to
480544c
Compare
allredj
left a comment
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: 480544c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92626177
480544c to
0942e1f
Compare
allredj
left a comment
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: 0942e1f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/92649557