Skip to content

Make renamedt inherit from underlyingt#4454

Merged
tautschnig merged 1 commit intodiffblue:developfrom
romainbrenguier:renamedt-inheritance
Mar 29, 2019
Merged

Make renamedt inherit from underlyingt#4454
tautschnig merged 1 commit intodiffblue:developfrom
romainbrenguier:renamedt-inheritance

Conversation

@romainbrenguier
Copy link
Copy Markdown
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
Copy Markdown
Contributor

smowton commented Mar 29, 2019

Counter-proposal: smowton@1daa2c6

Already suggested that to @owen-jones-diffblue

Copy link
Copy Markdown
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
Copy Markdown
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