-
Notifications
You must be signed in to change notification settings - Fork 273
Cleanup find_symbols API #6727
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
Cleanup find_symbols API #6727
Conversation
3809a49
to
3f6ecba
Compare
This function is trying to do too much.
|
Codecov Report
@@ Coverage Diff @@
## develop #6727 +/- ##
===========================================
- Coverage 77.78% 77.78% -0.01%
===========================================
Files 1567 1567
Lines 179701 179769 +68
===========================================
+ Hits 139789 139840 +51
- Misses 39912 39929 +17
Continue to review full report at Codecov.
|
That makes a lot of sense as far as the user-facing API is concerned (which already has different functions), but I'm not sure the underlying implementation would be very different? Expressions can be contained in types and types in expressions, so the iteration will be rather similar?
The
With the above changes this might end up as nothing more than a Boolean? I'll give it a try. |
I can certainly see a case for offering separate, easy functions as part of the user-facing API, which then call one (complex) function internally to avoid code duplication.
Super! |
3f6ecba
to
5c0d9fc
Compare
@kroening I hope that the state at the end of commit series in this PR matches your expectations. The individual commits should be meaningful, but there is some back&forth, so it's probably best to either checkout the branch or just review all code changes at once. |
|
5c0d9fc
to
307b67c
Compare
Thank you, done.
Done.
I cannot rule out that such a case exists, but I'm not currently aware of one. There may well be places that currently feature a local lookalike of |
Let's go with the PR as is for now. In the long term, it makes sense to change the default semantics of the |
The existing code did not permit configuring what kinds of symbols are to be found. It had a single user within the code base, and even that one was not a good use of it for it constructed a single-element set. The new implementation does not yet make use of potential efficiency advantages of "has a symbol" over "find the existing symbols," but such improvements will be done based on further cleanup of find_symbols code.
"F_BOTH" is not a good fit when there are three (and not two) other entries. While at it, also add support to selectively choose current or next expression symbols.
Make the two Boolean parameters of find_symbols(expr, set, bool, bool) optional so that each existing users can safely use that function (or another, even more suitable, function) instead.
This is never used in CBMC's code base.
Each function used a different approach, with different potential omissions of symbols. Instead, use a single way to traverse expressions (and types), and configure the operation done via a parameter. All other (non-deprecated) functions are now just thin wrappers.
This is just a change in the enum tag.
…_expr With the removal of support for ID_next_symbol all uses of `has_symbol` searched for symbol expressions only.
Adds a new symbol kind to distinguish bound from unbound ones. Add documentation to all non-deprecated functions and clarify whether or not bound symbols are included.
307b67c
to
5bf57ef
Compare
The various functions declared in
find_symbols.h
might sound alike, but actually have different semantics. I wasn't really sure what to use anymore, so I went for a cleanup instead. Requires #6725 and #6726. Please review commit-by-commit.