Skip to content

use code_blockt::statements() where appropriate #2830

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 20, 2018

Conversation

kroening
Copy link
Member

add/move are type-safe; copy_to_operands and move_to_operands are not.

@kroening
Copy link
Member Author

I'll clang-format once reviewed; it's easier to review without.

Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

This would I suppose be a good time to apply this change in TG as well - how urgently do you want to get this in? It still needs a bump and I'd rather not see the introduction of synonym methods (labelled ❓ )

@@ -118,12 +118,12 @@ class code_blockt:public codet

void move(codet &code)
{
move_to_operands(code);
exprt::move_to_operands(code);
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason for this change?

@@ -101,21 +101,39 @@ inline codet &to_code(exprt &expr)
class code_blockt:public codet
{
public:
typedef std::vector<codet> code_operandst;

code_operandst &code_operands()
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ What's the purpose of having both code_operands() and statements()?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea is to eventually have code_operands() in codet, once codet stops inheriting from exprt.

@kroening
Copy link
Member Author

No genuine urgency to do this on TG.

Copy link
Contributor

@allredj allredj left a 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: 658c93f).
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).

@@ -787,16 +787,16 @@ code_blockt &java_bytecode_convert_methodt::get_or_create_block_for_pcrange(
return this_block;

// Find the child code_blockt where the queried range begins:
auto child_iter=this_block.operands().begin();
auto child_iter=this_block.statements().begin();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Throughout this commit: please weave in clang-format style spacing while touching the various lines.

++child_iter;
assert(child_iter!=this_block.operands().end());
assert(child_iter!=this_block.statements().end());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be a DATA_INVARIANT

std::advance(child_iter, child_offset);
assert(child_iter!=this_block.operands().end());
auto &child_label=to_code_label(to_code(*child_iter));
assert(child_iter!=this_block.statements().end());
Copy link
Collaborator

Choose a reason for hiding this comment

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

This assert actually never was good enough as far as I can tell: the iterator should have been advanced well beyond the end() iterator.

@tautschnig tautschnig assigned kroening and unassigned tautschnig Oct 8, 2018
@kroening kroening force-pushed the code_block_move_add branch from 2311e72 to 361bba3 Compare October 11, 2018 10:17
Copy link
Contributor

@allredj allredj left a 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: 361bba3).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/87625389
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).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

@kroening kroening force-pushed the code_block_move_add branch from 361bba3 to 7813fec Compare October 14, 2018 13:45
@kroening kroening assigned smowton and unassigned kroening Oct 14, 2018
static bool move_label_ifthenelse(
exprt &expr,
exprt &label_dest)
static bool move_label_ifthenelse(exprt &expr, exprt &label_dest)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was clang-format.

Copy link
Contributor

@allredj allredj left a 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: 7813fec).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/87882190

Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

goto-instrument changes look fine.

This avoids a runtime check that the operand is codet.
@kroening kroening force-pushed the code_block_move_add branch from 5dceb25 to 01fd831 Compare October 18, 2018 13:34
Copy link
Contributor

@allredj allredj left a 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: ec1b59a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88419397
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).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

Copy link
Contributor

@allredj allredj left a 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: 5dceb25).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88420660
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).

The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.

Copy link
Contributor

@allredj allredj left a 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: 01fd831).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/88424313

@kroening kroening merged commit 68a0b70 into develop Oct 20, 2018
@kroening kroening deleted the code_block_move_add branch October 20, 2018 09:09
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.

8 participants