Skip to content

Commit ae36adc

Browse files
committed
Pass widening_mode into abstract_environment::merge
1 parent 2fdf995 commit ae36adc

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/analyses/variable-sensitivity/abstract_environment.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ abstract_object_pointert abstract_environmentt::add_object_context(
285285
return object_factory->wrap_with_context(abstract_object);
286286
}
287287

288-
bool abstract_environmentt::merge(const abstract_environmentt &env)
288+
bool abstract_environmentt::merge(
289+
const abstract_environmentt &env,
290+
wident widen_mode)
289291
{
290292
// for each entry in the incoming environment we need to either add it
291293
// if it is new, or merge with the existing key if it is not present

src/analyses/variable-sensitivity/abstract_environment.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ class variable_sensitivity_object_factoryt;
3232
using variable_sensitivity_object_factory_ptrt =
3333
std::shared_ptr<variable_sensitivity_object_factoryt>;
3434

35+
enum class wident
36+
{
37+
no,
38+
should_widen
39+
};
40+
3541
class abstract_environmentt
3642
{
3743
public:
@@ -186,9 +192,10 @@ class abstract_environmentt
186192
/// Computes the join between "this" and "b"
187193
///
188194
/// \param env: the other environment
195+
/// \param widen_mode: indicates if this is a widening merge
189196
///
190197
/// \return A Boolean, true when the merge has changed something
191-
virtual bool merge(const abstract_environmentt &env);
198+
virtual bool merge(const abstract_environmentt &env, wident widen_mode);
192199

193200
/// This should be used as a default case / everything else has failed
194201
/// The string is so that I can easily find and diagnose cases where this

src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ bool variable_sensitivity_domaint::merge(
204204
std::cout << "Merging from/to:\n " << from->location_number << " --> "
205205
<< to->location_number << '\n';
206206
#endif
207-
207+
auto widen_mode = from->should_widen(*to) ? wident::should_widen : wident::no;
208208
// Use the abstract_environment merge
209-
bool any_changes = abstract_state.merge(b.abstract_state);
209+
bool any_changes = abstract_state.merge(b.abstract_state, widen_mode);
210210

211211
DATA_INVARIANT(abstract_state.verify(), "Structural invariant");
212212
return any_changes;

0 commit comments

Comments
 (0)