Skip to content

Add initializer list constructor to struct/union typet and cleanup API use [blocks: #3597] #3623

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
Jan 21, 2019

Conversation

tautschnig
Copy link
Collaborator

Use the rvalue constructor and also review any other use of constructors
to avoid unnecessary copies.

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

@@ -47,29 +47,24 @@ SCENARIO(
{
// Create struct A { A *x; A *y }

struct_typet struct_A;
struct_typet struct_A({{"x", pointer_typet(symbol_typet("A"), 64)},
{"y", pointer_typet(symbol_typet("A"), 64)}});
struct_A.set_tag("A");
Copy link
Member

Choose a reason for hiding this comment

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

These should now actually be struct_tag types!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If that's a strict requirement in goto programs then we need a validation pass that says so?! Otherwise that unit test would seem ok to me?

@@ -1182,7 +1182,7 @@ void cpp_typecheckt::typecheck_expr_member(
else
{
// it must be a static component
const struct_typet::componentt pcomp=
const struct_typet::componentt &pcomp =
type.get_component(to_symbol_expr(symbol_expr).get_identifier());
Copy link
Member

Choose a reason for hiding this comment

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

Seems unrelated to PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I may have overstretched the "cleanup API use."

const exprt pcomp=struct_type.get_component(identifier);
const struct_typet &struct_type = static_cast<const struct_typet &>(
cpp_typecheck.lookup(id.class_identifier).type);
const exprt &pcomp = struct_type.get_component(identifier);
assert(pcomp.is_not_nil());
Copy link
Member

Choose a reason for hiding this comment

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

Same here?

@@ -1557,7 +1557,7 @@ void c_typecheck_baset::typecheck_expr_member(exprt &expr)
expr.get(ID_component_name);

// first try to find directly
struct_union_typet::componentt component=
const struct_union_typet::componentt &component =
struct_union_type.get_component(component_name);

Copy link
Member

Choose a reason for hiding this comment

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

Seems unrelated?

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: 2133fbc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95909725

@tautschnig tautschnig force-pushed the struct-union-constructor branch from 2133fbc to 4bda3d9 Compare January 2, 2019 11:12
to_struct_type(follow(static_cast<const typet &>
(expr.type().find("to-member"))));
const struct_typet &from_struct = to_struct_type(
follow(static_cast<const typet &>(expr.type().find("to-member"))));
Copy link
Member

Choose a reason for hiding this comment

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

⛏ Define an irep_id for it?

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 in #3658.

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: 4bda3d9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96062860

@tautschnig tautschnig assigned kroening and unassigned tautschnig Jan 2, 2019
@tautschnig tautschnig force-pushed the struct-union-constructor branch 2 times, most recently from afbeaaa to 71045cd Compare January 5, 2019 14:10
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: 71045cd).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96377847

@tautschnig tautschnig force-pushed the struct-union-constructor branch from 71045cd to 66e000c Compare January 10, 2019 08:23
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: 66e000c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96875958

@tautschnig tautschnig force-pushed the struct-union-constructor branch from 66e000c to 22d614d Compare January 14, 2019 08:55
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: 22d614d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97216287

…I use

Use the rvalue constructor and also review any other use of constructors
to avoid unnecessary copies.
@tautschnig tautschnig force-pushed the struct-union-constructor branch from 22d614d to ac4ae98 Compare January 14, 2019 22:59
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: ac4ae98).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97321137

@tautschnig tautschnig merged commit 1c12543 into diffblue:develop Jan 21, 2019
@tautschnig tautschnig deleted the struct-union-constructor branch January 21, 2019 14:59
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.

4 participants