-
Notifications
You must be signed in to change notification settings - Fork 274
Replace some uses of forall_operands by ranged-for #5790
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
Conversation
99e6f8a
to
9d0e497
Compare
Codecov ReportBase: 78.38% // Head: 78.34% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #5790 +/- ##
===========================================
- Coverage 78.38% 78.34% -0.04%
===========================================
Files 1647 1645 -2
Lines 190343 190355 +12
===========================================
- Hits 149196 149131 -65
- Misses 41147 41224 +77
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
lgtm
forall_operands(it, expr) | ||
if(!is_constant(expr.op0())) | ||
return false; | ||
#if 0 |
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.
👍
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.
A few questions about style but nothing blocking.
9d0e497
to
e01fcff
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.
LGTM
@@ -693,9 +693,11 @@ bool custom_bitvector_domaint::has_get_must_or_may(const exprt &src) | |||
if(src.id() == ID_get_must || src.id() == ID_get_may) | |||
return true; | |||
|
|||
forall_operands(it, src) | |||
if(has_get_must_or_may(*it)) | |||
for(const auto &op : src.operands()) |
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.
FWIW this is just std::any(src.operands.begin(), src.operands.end(), has_get_must_or_may)
e01fcff
to
08bc470
Compare
src/jsil/parser.y
Outdated
@@ -132,9 +132,9 @@ procedure_decl: TOK_PROCEDURE proc_ident '(' parameters_opt ')' | |||
{ | |||
symbol_exprt proc(to_symbol_expr(parser_stack($2))); | |||
code_typet::parameterst parameters; | |||
forall_operands(it, parser_stack($4)) | |||
for(const auto &op : as_const(parser_stack($4)).operands()) |
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 deviates from the pattern elsewhere -- why the as_const
?
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.
Because .operands()
would trigger a(n unnecessary) write on the underlying irep, temporarly breaking (probably non-existing) sharing.
08bc470
to
5ad94ce
Compare
5ad94ce
to
9d596f0
Compare
9d596f0
to
3e59f2e
Compare
3e59f2e
to
680354a
Compare
680354a
to
4e2f85c
Compare
4e2f85c
to
139f893
Compare
139f893
to
011bc44
Compare
011bc44
to
e4aaa48
Compare
e4aaa48
to
145feb0
Compare
In some (but not all!) cases of forall_operands we do not actually need the iterator.
145feb0
to
7cb1f5b
Compare
In some (but not all!) cases of forall_operands we do not actually need the
iterator.