-
Notifications
You must be signed in to change notification settings - Fork 277
Document byte_update_exprt and rename non-const functions #4675
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
Document byte_update_exprt and rename non-const functions #4675
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.
Renaming functions without following an appropriate deprecation path is a no-go.
ce2a97a
to
6fe7c1e
Compare
I've now kept both versions and deprecated the old one. |
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 me - except I'd prefer if the set_*
methods actually took an argument as discussed.
src/util/simplify_expr.cpp
Outdated
@@ -2057,20 +2057,22 @@ bool simplify_exprt::simplify_byte_extract(byte_extract_exprt &expr) | |||
|
|||
bool simplify_exprt::simplify_byte_update(byte_update_exprt &expr) | |||
{ | |||
const byte_update_exprt &expr_const = as_const(expr); |
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.
Is this use of as_const
actually necessary?
Documentation was missing
The documentation was missing.
In some cases the non-const version was unnecessarily called because it has the same name as the const version. We define accessor functions with a different name to make the non-constantness explicit.
The non-const accessors which have the same name as the const one shouldn't be used anymore to avoid confusion and unknowningly calling the non-const version.
6fe7c1e
to
15e9d8c
Compare
The non-const version shouldn't be used anymore when we don't actually need to modify the operands.
15e9d8c
to
635ad8b
Compare
In some cases the non-const version was unnecessarily called because it
has the same name as the const version.
This pull requests avoids that from happening in 9 cases for op, 2 for value and 3 for
offset.