-
Notifications
You must be signed in to change notification settings - Fork 277
C++ front-end: use ranged for #3066
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
kroening
commented
Sep 29, 2018
- Each commit message has a non-empty body, explaining why the change was made.
- My contribution is formatted in line with CODING_STANDARD.md.
- Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- 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).
- My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- White-space or formatting changes outside the feature-related changed lines are in commits of their own.
7137d06
to
02b517f
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: 7137d06).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86369132
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).
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.
Great, with even more room for related cleanup I believe.
src/cpp/cpp_typecheck_fargs.cpp
Outdated
for(std::size_t i=0; i<function_call.op1().operands().size(); i++) | ||
operands.push_back(function_call.op1().operands()[i]); | ||
for(const auto &op : function_call.op1().operands()) | ||
operands.push_back(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.
Rewrite this (and some lines above) as operands = function_call.op1().operands();
?
src/cpp/cpp_typecheck_resolve.cpp
Outdated
@@ -483,7 +462,7 @@ void cpp_typecheck_resolvet::disambiguate_functions( | |||
1000*template_distance+args_distance; | |||
|
|||
distance_map.insert( | |||
std::pair<std::size_t, exprt>(total_distance, *it)); | |||
std::pair<std::size_t, exprt>(total_distance, old_id)); |
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.
More modernisation: distance_map.insert({total_distance, old_id});
src/cpp/cpp_constructor.cpp
Outdated
it++) | ||
function_call.op1().copy_to_operands(*it); | ||
for(auto &op : operands_tc) | ||
function_call.op1().copy_to_operands(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 think we can get rid of this loop entirely if using a 3-argument constructor for function_call
above.
{ | ||
for(unsigned i=0; i<indent; i++) out << ' '; | ||
out << " secondary_scope=" << (*it)->identifier << '\n'; | ||
out << " secondary_scope=" << s->identifier << '\n'; |
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 could further simplify this loop by using std::string(indent, ' ')
in place of the for
loop above. Applies several times across this file.
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: 02b517f).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86369462
All done! |
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: 76f145d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86389696
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: 4bae1df).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86391508