-
Notifications
You must be signed in to change notification settings - Fork 273
Introduce binding_exprt::instantiate #6192
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
kroening
commented
Jun 19, 2021
- Each commit message has a non-empty body, explaining why the change was made.
- Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
- n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
- Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
- n/a My commit message includes data points confirming performance improvements (if claimed).
- My PR is restricted to a single feature or bugfix.
- n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.
f4ede69
to
ff7b7d9
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6192 +/- ##
===========================================
+ Coverage 67.40% 75.16% +7.75%
===========================================
Files 1157 1456 +299
Lines 95236 161128 +65892
===========================================
+ Hits 64197 121107 +56910
- Misses 31039 40021 +8982
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
src/util/std_expr.cpp
Outdated
value_map[variables[i]] = values[i]; | ||
} | ||
|
||
// build a subsitution map |
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.
// build a subsitution map | |
// build a substitution map |
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.
Fixed
|
||
static optionalt<exprt> substitute_symbols_rec( | ||
const std::map<irep_idt, exprt> &substitutions, | ||
exprt src) |
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.
Is it necessary to pass by value here (a copy is taken below)?
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 copy happens in most cases -- so this is the pattern "use pass by value when copy is inevitable".
This introduces a helper method to substitute variables that are bound in a binding_exprt by a vector of given values. The substitution algorithm preserves sharing when no substitution is made and is aware of hiding when nesting bindings.
lambda_exprt uses a binding_exprt, which means that the application of a function given as lambda expression is a special case of an instantiation.
ff7b7d9
to
e3d8334
Compare