Skip to content

Make renamedt inherit from underlyingt #4454

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
Mar 29, 2019

Conversation

romainbrenguier
Copy link
Contributor

@romainbrenguier romainbrenguier commented Mar 29, 2019

This is so that we can easily convert from an exprt to a renamedt using
static_cast.
The potential use case, is to be able to look at all the operands of a
renamedt, as renamedt themselves without having to construct new
objects.
For instanc, we could declare a renamedt method:

void renamedt::apply_to_operands(std::function<void(renamedt&)> f)
{
  for(exprt &op : operands())
    f(static_cast<renamedt&>(op));
}

The idea for correctness is that if an expression is renamed then all its operands also are, by construction.

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

This is so that we can easily convert from an exprt to a renamedt using
static_cast.
The potential use case, is to be able to look at all the operands of a
renamedt, as renamedt themselves without having to construct new
objects.
For instance assuming `f` takes `renamedt` as argument, we could declare
a renamedt method:
```
void renamedt::apply_to_operands()
{
  for(exprt &op : operands())
    f(static_cast<renamedt&>(op));
}
```
@smowton
Copy link
Contributor

smowton commented Mar 29, 2019

Counter-proposal: smowton@1daa2c6

Already suggested that to @owen-jones-diffblue

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: aa3f0f1).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/106290116
Status will be re-evaluated on next push.
Common spurious failures include: 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); compatibility was already broken by an earlier merge.

Copy link
Contributor

@owen-mc-diffblue owen-mc-diffblue left a comment

Choose a reason for hiding this comment

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

I will rebase #4444 on this so we can avoid calling constructors all the time

@tautschnig tautschnig merged commit b0086f1 into diffblue:develop Mar 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants