-
Notifications
You must be signed in to change notification settings - Fork 277
Clean up in the value set API #4690
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
tautschnig
merged 7 commits into
diffblue:develop
from
romainbrenguier:clean-up/value-set
Jun 3, 2019
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
318d49a
get_value_set takes expr by copy
romainbrenguier b633d6d
Deprecate offset_is_zero
romainbrenguier 01dff41
Deprecate value_sett::get
romainbrenguier e1eb12e
Deprecate dynamic_object_id_sett
romainbrenguier 1e06eda
Add versions of get_value_set returning a value
romainbrenguier 8d497eb
Use vector instead of list for get_value_set result
romainbrenguier fa1412c
Predefine DEPRECATED macro in doxyfile
romainbrenguier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ Author: Daniel Kroening, [email protected] | |
#include <util/simplify_expr.h> | ||
|
||
#include <langapi/language_util.h> | ||
#include <util/range.h> | ||
|
||
#ifdef DEBUG | ||
#include <iostream> | ||
|
@@ -308,8 +309,7 @@ bool value_sett::eval_pointer_offset( | |
{ | ||
assert(expr.operands().size()==1); | ||
|
||
object_mapt reference_set; | ||
get_value_set(expr.op0(), reference_set, ns, true); | ||
const object_mapt reference_set = get_value_set(expr.op0(), ns, true); | ||
|
||
exprt new_expr; | ||
mp_integer previous_offset=0; | ||
|
@@ -352,12 +352,11 @@ bool value_sett::eval_pointer_offset( | |
} | ||
|
||
void value_sett::get_value_set( | ||
const exprt &expr, | ||
exprt expr, | ||
value_setst::valuest &dest, | ||
const namespacet &ns) const | ||
{ | ||
object_mapt object_map; | ||
get_value_set(expr, object_map, ns, false); | ||
object_mapt object_map = get_value_set(std::move(expr), ns, false); | ||
|
||
for(object_map_dt::const_iterator | ||
it=object_map.read().begin(); | ||
|
@@ -372,17 +371,37 @@ void value_sett::get_value_set( | |
#endif | ||
} | ||
|
||
std::vector<exprt> | ||
value_sett::get_value_set(exprt expr, const namespacet &ns) const | ||
{ | ||
const object_mapt object_map = get_value_set(std::move(expr), ns, false); | ||
return make_range(object_map.read()) | ||
.map([&](const object_map_dt::value_type &pair) { return to_expr(pair); }); | ||
} | ||
|
||
void value_sett::get_value_set( | ||
const exprt &expr, | ||
exprt expr, | ||
object_mapt &dest, | ||
const namespacet &ns, | ||
bool is_simplified) const | ||
{ | ||
exprt tmp(expr); | ||
if(!is_simplified) | ||
simplify(tmp, ns); | ||
simplify(expr, ns); | ||
|
||
get_value_set_rec(expr, dest, "", expr.type(), ns); | ||
} | ||
|
||
value_sett::object_mapt value_sett::get_value_set( | ||
exprt expr, | ||
const namespacet &ns, | ||
bool is_simplified) const | ||
{ | ||
if(!is_simplified) | ||
simplify(expr, ns); | ||
|
||
get_value_set_rec(tmp, dest, "", tmp.type(), ns); | ||
object_mapt dest; | ||
get_value_set_rec(expr, dest, "", expr.type(), ns); | ||
return dest; | ||
} | ||
|
||
/// Check if 'suffix' starts with 'field'. | ||
|
@@ -1304,8 +1323,7 @@ void value_sett::assign( | |
else | ||
{ | ||
// basic type | ||
object_mapt values_rhs; | ||
get_value_set(rhs, values_rhs, ns, is_simplified); | ||
object_mapt values_rhs = get_value_set(rhs, ns, is_simplified); | ||
|
||
// Permit custom subclass to alter the read values prior to write: | ||
adjust_assign_rhs_values(rhs, ns, values_rhs); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we can just remove what isn't even implemented.
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 don't know. In test-gen there were cases of cpp files used instead of the cbmc ones which could add new implementation not existing in cbmc