Skip to content

Commit 1c76d53

Browse files
committed
Pass widening_mode into abstract_environment::merge
1 parent 83414be commit 1c76d53

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
@@ -329,7 +329,9 @@ abstract_object_pointert abstract_environmentt::add_object_context(
329329
return object_factory->wrap_with_context(abstract_object);
330330
}
331331

332-
bool abstract_environmentt::merge(const abstract_environmentt &env)
332+
bool abstract_environmentt::merge(
333+
const abstract_environmentt &env,
334+
wident widen_mode)
333335
{
334336
// for each entry in the incoming environment we need to either add it
335337
// 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:
@@ -187,9 +193,10 @@ class abstract_environmentt
187193
/// Computes the join between "this" and "b"
188194
///
189195
/// \param env: the other environment
196+
/// \param widen_mode: indicates if this is a widening merge
190197
///
191198
/// \return A Boolean, true when the merge has changed something
192-
virtual bool merge(const abstract_environmentt &env);
199+
virtual bool merge(const abstract_environmentt &env, wident widen_mode);
193200

194201
/// This should be used as a default case / everything else has failed
195202
/// 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)