Skip to content

Conversation

@romainbrenguier
Copy link
Contributor

@romainbrenguier romainbrenguier commented Jun 26, 2019

This clarifies the meaning of skeletons, which we use in assignmentt.
This makes sure the skeleton field is always of the correct form for a
skeleton.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • [na] 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).
  • [na] My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • [na] White-space or formatting changes outside the feature-related changed lines are in commits of their own.

This clarifies the meaning of skeletons, which we use in assignmentt.
This makes sure the skeleton field is always of the correct form for a
skeleton.
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

I note all uses of compose and remove_op0 go together, combine them into one method compose(exprt)?

@romainbrenguier
Copy link
Contributor Author

@smowton

I note all uses of compose and remove_op0 go together, combine them into one method compose(exprt)?

I'm not sure I would like that because it's hiding the fact that the first operand of the expression is discarded. To be clear it would have to be named something like compose_by_removing_op0.

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

OK, this is certainly better than the current code anyhow

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.

Personally think the name isn't very clear, but still more clear than using the nil_expr directly

/// \ref expr_skeletont::apply). It can also be composed with another skeleton,
/// let say `☐.some_field` which would give the skeleton `☐.some_field[index]`
/// (see \ref expr_skeletont::compose).
class expr_skeletont final
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 I wouldn't have guessed the behaviour of this expression from the name. Perhaps algebraic_expr, partial_expr expr_template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I couldn't find a very good name, but algebraic_expr could be mistaken for a special type of exprt (like expr containing symbols), expr_template would be expected to be a template, partial_expr is as good as expr_skeleton I think.


/// Replace the missing part of the current skeleton by another skeleton,
/// ending in a bigger skeleton corresponding to the two combined.
expr_skeletont compose(expr_skeletont other) const;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this would be very easy and worthwhile to unit test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add them in another pull request #4843 because it takes a lot of tries to get CI to pass these days.

@romainbrenguier romainbrenguier merged commit 0a0e30b into diffblue:develop Jun 27, 2019
@romainbrenguier romainbrenguier deleted the refactor/expr_skeleton branch June 27, 2019 07:19
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: c852e72).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/117093045

exprt full_lhs2 = nil_exprt{};
full_lhs.type() = int_type;
symex_assign.assign_symbol(ssa_foo, full_lhs2, rhs2, guard);
symex_assign.assign_symbol(ssa_foo, expr_skeletont{}, rhs2, guard);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know I'm late to the party, but how is this equivalent to the previous code? The previous code had a type assigned. @romainbrenguier ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants