Skip to content

Remove goto_programt::instructiont::type_nonconst #6419

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

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

tautschnig
Copy link
Collaborator

Use of this method was never advised, and the remaining two uses can be
rewritten to use more appropriate (and modern) APIs.

  • 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.

(goto_program_instruction_typet)irepconverter.read_gb_word(in),
static_cast<const exprt &>(irepconverter.reference_convert(in)),
{}};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of evaluation of function arguments is unspecified in C++ -- i.e., this may read the entries of the binary in the wrong order.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

back_edge->type_nonconst() = GOTO;
instructions.emplace_back(
goto_programt::make_goto(loop_head, back_edge_location));
loop_head->incoming_edges.insert(--instructions.end());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use std::prev here, given that the side effect of the predecrement operator is not used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Use of this method was never advised, and the remaining two uses can be
rewritten to use more appropriate (and modern) APIs.
@codecov
Copy link

codecov bot commented Oct 28, 2021

Codecov Report

Merging #6419 (f6fa03c) into develop (fe6ab00) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6419      +/-   ##
===========================================
- Coverage    75.99%   75.98%   -0.01%     
===========================================
  Files         1524     1524              
  Lines       164300   164299       -1     
===========================================
- Hits        124854   124843      -11     
- Misses       39446    39456      +10     
Impacted Files Coverage Δ
src/goto-programs/goto_program.h 89.76% <ø> (-0.06%) ⬇️
src/goto-programs/read_bin_goto_object.cpp 87.93% <100.00%> (+0.21%) ⬆️
unit/goto-programs/structured_trace_util.cpp 100.00% <100.00%> (ø)
src/goto-instrument/goto_program2code.cpp 68.37% <0.00%> (-0.97%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07895ef...f6fa03c. Read the comment docs.

@tautschnig tautschnig merged commit ce2680b into diffblue:develop Oct 29, 2021
@tautschnig tautschnig deleted the nonconst-cleanup branch October 29, 2021 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants