-
Notifications
You must be signed in to change notification settings - Fork 274
Check symbol table mappings #3187
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
Check symbol table mappings #3187
Conversation
Do you want reviews before #3123 is merged? |
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 have only reviewed the last commit; so approval is for that, not the whole stack.
src/util/symbol_table.cpp
Outdated
map_matches = true; | ||
|
||
++base_map_search; | ||
} |
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.
bool map_matches =
std::find_if(
symbol_base_map.begin(),
symbol_base_map.end(),
[&](const typename symbol_base_mapt::value_type &pair) {
return pair.first == symbol.base_name && pair.second == symbol_key;
}) != symbol_base_map.end();
Doesn't the while loop actually go through all the elements past the first find
match?
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 !map_matches
condition in the while loop will terminate the loop at the first match, but I agree that your suggested use of the std library is a better way to go - I'll update, thanks :-)
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.
Actually, using equal_range
is probably better....
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 equal_range
would be logarithmic, unlike the above.
f337e41
to
a622be9
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.
LGTM
a622be9
to
bb11a70
Compare
bb11a70
to
0f18b68
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: 0f18b68).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91054169
This PR builds upon/depends upon #3123 (merged). It adds some basic sanity checking of the symbol table structure, namely that symbols are correctly keyed, and that
base_name
andmodule
maps are in sync with the symbols.