Check symbol table mappings#3187
Conversation
|
Do you want reviews before #3123 is merged? |
martin-cs
left a comment
There was a problem hiding this comment.
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.
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.
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.
Actually, using equal_range is probably better....
There was a problem hiding this comment.
Yes equal_range would be logarithmic, unlike the above.
f337e41 to
a622be9
Compare
a622be9 to
bb11a70
Compare
bb11a70 to
0f18b68
Compare
allredj
left a comment
There was a problem hiding this comment.
✔️
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_nameandmodulemaps are in sync with the symbols.