Skip to content

Commit 7509273

Browse files
author
martin
committed
Tidy up the code that handles function return edges
1 parent fce3a0e commit 7509273

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/pointer-analysis/value_set_domain.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,6 @@ class value_set_domain_templatet : public ai_domain_baset
9999
value_set.get_reference_set(expr, dest, ns);
100100
}
101101

102-
exprt get_return_lhs(locationt to) const
103-
{
104-
// get predecessor of "to"
105-
to--;
106-
107-
if(to->is_end_function())
108-
return static_cast<const exprt &>(get_nil_irep());
109-
110-
INVARIANT(to->is_function_call(), "must be the function call");
111-
112-
return to->call_lhs();
113-
}
114-
115102
xmlt output_xml(const ai_baset &ai, const namespacet &ns) const override
116103
{
117104
return value_set.output_xml();
@@ -143,7 +130,9 @@ void value_set_domain_templatet<VST>::transform(
143130

144131
case END_FUNCTION:
145132
{
146-
value_set.do_end_function(get_return_lhs(to_l), ns);
133+
locationt caller{to_l};
134+
--caller; // Unsafe in general but ai_baset should guarantee safety
135+
value_set.do_end_function(caller->call_lhs(), ns);
147136
break;
148137
}
149138

0 commit comments

Comments
 (0)