-
Notifications
You must be signed in to change notification settings - Fork 274
Define an add_const utility function #4257
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
Define an add_const utility function #4257
Conversation
67bada7
to
2c2228d
Compare
src/goto-symex/goto_symex_state.cpp
Outdated
@@ -345,10 +347,12 @@ void goto_symex_statet::rename( | |||
|
|||
INVARIANT( | |||
(expr.id() != ID_with || | |||
expr.type() == to_with_expr(expr).old().type()) && | |||
add_const(expr).type() == to_with_expr(add_const(expr)).old().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.
Maybe declare a const exprt &c_expr = expr;
before the INVARIANT
and use that in here? There are a lot of add_const
s here.
2c2228d
to
58d6d9c
Compare
Simply use |
|
It seems you'd need |
This is useful in particular when we want to force the const version of a method to be called. For exprt there can be differences in performance between const and non-const.
In some places the non const version of .type() and others would be called. We force the const version to be called by using as_const. In the example in `jbmc/regression/jbmc-strings/StringConcat/test_buffer_nondet_loop5` this reduced the number of calls to detach from 744638 to 736844.
58d6d9c
to
32af11e
Compare
done |
This is useful in particular when we want to force the const version of
a method to be called.
For
exprt
there can be differences in performance between const andnon-const.
This is applied to
goto_symex_statet::rename
as an example, and trying of the example injbmc/regression/jbmc-strings/StringConcat/test_buffer_nondet_loop5
it reduced the number of calls to detach from 744638 to 736844.