-
Notifications
You must be signed in to change notification settings - Fork 274
Use non-deprecated constructors for code*t [blocks: #3800] #3928
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
542dfb3
to
daca5ab
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: daca5ab).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98599638
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- 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).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
daca5ab
to
5b54142
Compare
target_number(nil_target) | ||
explicit instructiont(goto_program_instruction_typet _type) | ||
: code(ID_nil), | ||
source_location(static_cast<const source_locationt &>(get_nil_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.
This change adds non-trivial cost when constructing instructiont
-- I am wondering whether we should instead move forward on the consolidation of the ireps in there.
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.
How about code(static_cast<codet &>(get_nil_irep())
as a cheaper alternative? Of course the proper consolidation is the correct long-term solution.
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.
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: 5b54142).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98710967
5b54142
to
4ea2ff6
Compare
4ea2ff6
to
6c901b6
Compare
We do not use this anywhere except that a regression test relied on it for no particular reason.
The default constructor for codet is deprecated.
6c901b6
to
55ca1ef
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: 55ca1ef).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98738338
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.
Yes, although I am less convinced of the net value of this vs. some of the other construction PRs.
@@ -217,7 +217,6 @@ bool flow_insensitive_analysis_baset::do_function_call( | |||
r->location_number=0; | |||
|
|||
goto_programt::targett t=temp.add_instruction(END_FUNCTION); | |||
t->code.set(ID_identifier, code.function()); |
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 this might be lost from a different commit. I'm not sure it is wrong but, thought you might want to know.
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.
Note that this is in a separate commit ("Do not sneak an ID_identifier entry into END_FUNCTION"). I ended up fixing this as the regression test touched in the very same commit had surprisingly started to fail. The root cause was that .is_nil()
code doesn't get printed with --print-internal-representation
, and the changes in this PR make an END_FUNCTION
's code nil
, unlike previously where it simply was uninitialised. So we ended up with a codet
that has some content but still .is_nil()
.
@@ -648,7 +648,7 @@ void c_typecheck_baset::typecheck_declaration( | |||
// mark as 'already typechecked' | |||
make_already_typechecked(declaration.type()); | |||
|
|||
codet contract; | |||
irept contract; |
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.
Is less type information really an improvement?
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.
In this case: yes, because we really don't care about the container of the information, just the contents we put in it. And that declaration makes this explicit.
@@ -167,7 +167,6 @@ void goto_convert_functionst::convert_function( | |||
goto_programt::targett end_function=tmp_end_function.add_instruction(); | |||
end_function->type=END_FUNCTION; | |||
end_function->source_location=end_location; | |||
end_function->code.set(ID_identifier, 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.
As with previous comment, is this from removing function names?
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.
See above, part of the same cleanup.
The default constructor for codet is deprecated.