-
Notifications
You must be signed in to change notification settings - Fork 274
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
Add initializer list constructor to struct/union typet and cleanup API use [blocks: #3597] #3623
Conversation
7f7d4a6
to
2133fbc
Compare
@@ -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"); |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unrelated to PR?
There was a problem hiding this comment.
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."
src/cpp/cpp_typecheck_resolve.cpp
Outdated
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()); |
There was a problem hiding this comment.
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); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unrelated?
There was a problem hiding this 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
2133fbc
to
4bda3d9
Compare
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")))); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #3658.
There was a problem hiding this 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
afbeaaa
to
71045cd
Compare
There was a problem hiding this 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
71045cd
to
66e000c
Compare
There was a problem hiding this 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
66e000c
to
22d614d
Compare
There was a problem hiding this 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.
22d614d
to
ac4ae98
Compare
There was a problem hiding this 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
Use the rvalue constructor and also review any other use of constructors
to avoid unnecessary copies.