-
Notifications
You must be signed in to change notification settings - Fork 274
added code_blockt::statements(), which is a vector of codet #3080
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
Conversation
380ad23
to
bc925a1
Compare
while(child_iter!=this_block.operands().end() && | ||
to_code(*child_iter).get_statement()==ID_decl) | ||
while(child_iter != this_block.statements().end() && | ||
to_code(*child_iter).get_statement() == ID_decl) |
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.
to_code
not longer needed
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.
ok
assert(tree.branch.size()==this_block_children.size()); | ||
for(auto blockidx=child_offset, blocklim=child_offset+nblocks; | ||
blockidx!=blocklim; | ||
++blockidx) | ||
newblock.move_to_operands(this_block_children[blockidx]); | ||
|
||
// Relabel the inner header: | ||
to_code_label(to_code(newblock.operands()[0])).set_label(new_label_irep); | ||
to_code_label(to_code(newblock.statements()[0])).set_label(new_label_irep); |
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.
to_code
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.
ok
@@ -1845,7 +1845,7 @@ codet java_bytecode_convert_methodt::convert_instructions( | |||
|
|||
if(c.get_statement()!=ID_skip) | |||
{ | |||
auto &lastlabel=to_code_label(to_code(root_block.operands().back())); | |||
auto &lastlabel = to_code_label(to_code(root_block.statements().back())); |
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.
to_code
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.
ok
bc925a1
to
4a6119a
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: 4a6119a).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86588721
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.
Overall ok with me, some more suggestions below.
to_code(block.operands().back()).get_statement()!=ID_label) | ||
if( | ||
!block.has_operands() || | ||
block.statements().back().get_statement() != ID_label) | ||
return false; |
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.
Nit pick: please add braces for readability
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.
ok
src/cpp/cpp_constructor.cpp
Outdated
return to_code(initializer); | ||
else | ||
{ | ||
block.move_to_operands(initializer); | ||
block.add(to_code(initializer)); |
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 think it would be worth moving this use of to_code
further up.
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.
ok
|
||
code_operandst &statements() | ||
{ | ||
return (code_operandst &)get_sub(); |
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.
Use static_cast
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.
That doesn't work, the C++ type system isn't that elaborate.
The key benefit is that clients no longer need to do conversion of the operands to codet.
4a6119a
to
7d8b70c
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: 7d8b70c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/86610791
explicit code_blockt(const std::list<codet> &_list):codet(ID_block) | ||
{ | ||
operandst &o=operands(); | ||
auto &o = statements(); |
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.
o
is probably not the best variable name anymore here.
@@ -22,10 +22,8 @@ static bool insert_at_label( | |||
const irep_idt &label, | |||
code_blockt &dest) | |||
{ | |||
Forall_operands(it, dest) | |||
for(auto &c : dest.statements()) |
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.
What does c
stand for?
The key benefit is that clients no longer need to do conversion of the
operands to codet.