-
Notifications
You must be signed in to change notification settings - Fork 286
Changes to sharing-map needed to merge VSD #5202
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
|
Some of these changes might now be redundant and I think it might be best to squash the commits as the messages aren't particularly meaningful now de-contextualised but I figured looking at the code might be the place to start. |
|
Note that the linter failures are unavoidable. |
| typename equalT> \ | ||
| type sharing_mapt<keyT, valueT, fail_if_equal, hashT, equalT> | ||
|
|
||
| #define SHARING_MAPTV(return_type, V) \ |
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.
Given that this is used in exactly one place I’d like to voice a strong preference for just inlining this macro.
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.
The already existing macro SHARING_MAPT4 does just the same, so I'd vote for using that one instead.
| void get_view(viewt &view) const; | ||
| template <class V> | ||
| void get_view(V &) const; | ||
| viewt get_view() const |
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 suppose technically this should be a template as well now.
| } | ||
| }; | ||
|
|
||
| namespace std |
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 is probably harmless but I think it’d nevertheless be preferable if we could find a way to do without this.
(I.e. remove it going forward after VSD is merged, not necessarily here)
|
Linter failures should be addressed with judicious use of |
| typename equalT> \ | ||
| type sharing_mapt<keyT, valueT, fail_if_equal, hashT, equalT> | ||
|
|
||
| #define SHARING_MAPTV(return_type, V) \ |
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.
The already existing macro SHARING_MAPT4 does just the same, so I'd vote for using that one instead.
| static void insert_view_item(sorted_viewt &v, view_itemt &&vi) | ||
| { | ||
| v.insert(vi); | ||
| } |
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.
Can we use forwarding references for these two functions? I.e.:
template <typename itemT>
static void insert_view_item(viewt &v, itemT &&vi)
{
v.push_back(std::forward<itemT>(vi));
}
| #endif | ||
|
|
||
| SHARING_MAPT(void)::get_view(viewt &view) const | ||
| SHARING_MAPTV(void, view_type)::get_view(view_type &view) const |
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 SHARING_MAPT4
| SECTION("View") | ||
| { | ||
| typedef std::pair<std::string, std::string> pt; | ||
| typedef std::pair<irep_idt, std::string> pt; |
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 changing this back to std::string. The intention was to sort the vector in lexicographic order. However, < for irep_idt sorts according to their sequence number AFAIK.
b5818f4 to
951cb61
Compare
3b13122 to
df7cea1
Compare
df7cea1 to
ba46eb4
Compare
83dd61e to
a56f389
Compare
a56f389 to
96101fd
Compare
96101fd to
ddb7e63
Compare
ddb7e63 to
228b9dd
Compare
This PR consists of a series of commits taken from the variable-sensitivity-domain branch originally by @hannes-steffenhagen-diffblue and @chrisr-diffblue . I have separated out the commits (and parts of commits) that just affect the sharing map so these can be reviewed and merged separately.