-
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
Clean up in the value set API #4690
Conversation
501cf06
to
46ffcec
Compare
@romainbrenguier Various CI steps in Travis are failing. |
src/pointer-analysis/value_set.h
Outdated
class object_map_dt | ||
: public std::map<object_numberingt::number_type, offsett> |
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 basically is a revert of 3b5263f. We should have really good reasons if that's what should happen.
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 I see. I will drop that commit for now and try to find a better solution
@@ -276,6 +277,7 @@ class value_sett | |||
const namespacet &ns) const; | |||
|
|||
/// Appears to be unimplemented. | |||
DEPRECATED(SINCE(2019, 05, 22, "Unimplemented")) | |||
expr_sett &get(const irep_idt &identifier, const std::string &suffix); |
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
@owen-jones-diffblue could you check if |
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.
Suggest dropping the std::map
-inheriting commit, which is a straight revert of #919, for the reasons given in that PR
void | ||
get_value_set(const exprt &expr, value_setst::valuest &dest) const override; | ||
|
||
std::list<exprt> get_value_set(const exprt &expr) const override; |
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 we're adding a new entry-point we probably shouldn't use std::list
, there's no call for a doubly-linked list here AFAICT
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.
but it is a list, and the fact that value_setst::valuest
is a list is public, by writing value_setst::valuest
we are just making it more complicated for the reader
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'm not suggesting valuest
, I'm suggesting std::vector
because that's the most performant C++ sequence container when you don't have a good reason for something else (e.g. deque or list)
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.
oh right
46ffcec
to
8265d1f
Compare
@tautschnig @smowton here is a PR to go instead of the std::map inheritance #4694 |
@smowton It does, but we can just add that field ourselves |
actually it seems location_number is used by value_set_domain_templatet so I will have to drop that commit too... |
f015a95
to
1d13bfa
Compare
@smowton I have now replace the use of list by vector |
@@ -34,9 +34,12 @@ class symex_dereference_statet: | |||
goto_symext::statet &state; | |||
const namespacet &ns; | |||
|
|||
DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead")) |
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.
vector returning
@@ -29,9 +29,12 @@ class dereference_callbackt | |||
public: | |||
virtual ~dereference_callbackt() = default; | |||
|
|||
DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead")) |
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.
vector returning
src/pointer-analysis/value_sets.h
Outdated
@@ -28,12 +28,19 @@ class value_setst | |||
typedef std::list<exprt> valuest; | |||
|
|||
// this is not const to allow a lazy evaluation | |||
DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead")) |
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.
vector returning
c138014
to
9b387f1
Compare
9b387f1
to
a4b2eed
Compare
@owen-jones-diffblue @smowton I've added a commit which gets rid of doxygen warning that were generated for this pull request, in case you want to have a look |
@romainbrenguier Please rebase now that #4729 is in to make CI happy. |
a4b2eed
to
88cc5c5
Compare
40b65af
to
27f87e8
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: 27f87e8).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/113842424
This avoids having to create a tmp expression and allows moving into the function.
This is unused
This is not implemented.
This is unused.
These return the computed value, which makes the information flow clearer in the program. We deprecate at the same time the functions from the previous version.
vectors are generally more efficient than list, unless we use concatenation or insertion which doesn't appear to be case here.
This prevents the macro from making doxyfile miss method definitions that are deprecated and automatically add the deprecated methods to the Deprecated List generated by doxygen
27f87e8
to
fa1412c
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: fa1412c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/114073541
Several methods/members of value set are actually not used and should be deprecated to simplify the API.
The
get_value_set
interface in which the result has to be given as argument is also not clear and it is better to return the result.