Skip to content

Commit 2e0b00b

Browse files
committed
Assigns clause should not track a single source location
Signed-off-by: Felipe R. Monteiro <felisous@amazon.com>
1 parent 57c787e commit 2e0b00b

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/goto-instrument/contracts/assigns.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ exprt assigns_clauset::targett::generate_containment_check(
9292
}
9393

9494
assigns_clauset::assigns_clauset(
95-
const exprt &expr,
95+
const exprt::operandst &assigns,
9696
const messaget &log,
9797
const namespacet &ns)
98-
: location(expr.source_location()), log(log), ns(ns)
98+
: log(log), ns(ns)
9999
{
100-
for(const auto &target_expr : expr.operands())
100+
for(const auto &target_expr : assigns)
101101
{
102102
add_to_global_write_set(target_expr);
103103
}
@@ -132,7 +132,8 @@ void assigns_clauset::remove_from_local_write_set(const exprt &expr)
132132
local_write_set.erase(targett(*this, expr));
133133
}
134134

135-
goto_programt assigns_clauset::generate_havoc_code() const
135+
goto_programt
136+
assigns_clauset::generate_havoc_code(const source_locationt &location) const
136137
{
137138
modifiest modifies;
138139
for(const auto &target : global_write_set)
@@ -176,7 +177,9 @@ exprt assigns_clauset::generate_subset_check(
176177
INVARIANT(
177178
subassigns.local_write_set.empty(),
178179
"Local write set for function calls should be empty at this point.\n" +
179-
subassigns.location.as_string());
180+
subassigns.local_write_set.begin()
181+
->address.source_location()
182+
.as_string());
180183

181184
exprt result = true_exprt();
182185
for(const auto &subtarget : subassigns.global_write_set)

src/goto-instrument/contracts/assigns.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ class assigns_clauset
5353
const assigns_clauset &parent;
5454
};
5555

56-
assigns_clauset(const exprt &, const messaget &, const namespacet &);
56+
assigns_clauset(
57+
const exprt::operandst &,
58+
const messaget &,
59+
const namespacet &);
5760

5861
void add_to_global_write_set(const exprt &);
5962
void remove_from_global_write_set(const exprt &);
6063
void add_to_local_write_set(const exprt &);
6164
void remove_from_local_write_set(const exprt &);
6265

63-
goto_programt generate_havoc_code() const;
66+
goto_programt generate_havoc_code(const source_locationt &) const;
6467
exprt generate_containment_check(const exprt &) const;
6568
exprt generate_subset_check(const assigns_clauset &) const;
6669

67-
const source_locationt &location;
6870
const messaget &log;
6971
const namespacet &ns;
7072

0 commit comments

Comments
 (0)