Skip to content

Commit fc8bb0c

Browse files
committed
goto_check() now gets function identifier
1 parent bd20036 commit fc8bb0c

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/analyses/goto_check.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ class goto_checkt
7373

7474
typedef goto_functionst::goto_functiont goto_functiont;
7575

76-
void goto_check(goto_functiont &goto_function, const irep_idt &mode);
76+
void goto_check(
77+
const irep_idt &function_identifier,
78+
goto_functiont &goto_function);
7779

7880
void collect_allocations(const goto_functionst &goto_functions);
7981

@@ -1523,11 +1525,13 @@ void goto_checkt::rw_ok_check(exprt &expr)
15231525
}
15241526

15251527
void goto_checkt::goto_check(
1526-
goto_functiont &goto_function,
1527-
const irep_idt &_mode)
1528+
const irep_idt &function_identifier,
1529+
goto_functiont &goto_function)
15281530
{
15291531
assertions.clear();
1530-
mode = _mode;
1532+
1533+
const auto &function_symbol = ns.lookup(function_identifier);
1534+
mode = function_symbol.mode;
15311535

15321536
bool did_something = false;
15331537

@@ -1720,7 +1724,7 @@ void goto_checkt::goto_check(
17201724
}
17211725
else if(i.is_end_function())
17221726
{
1723-
if(i.function==goto_functionst::entry_point() &&
1727+
if(function_identifier==goto_functionst::entry_point() &&
17241728
enable_memory_leak_check)
17251729
{
17261730
const symbolt &leak=ns.lookup(CPROVER_PREFIX "memory_leak");
@@ -1732,7 +1736,7 @@ void goto_checkt::goto_check(
17321736
t->code=code_assignt(leak_expr, leak_expr);
17331737

17341738
source_locationt source_location;
1735-
source_location.set_function(i.function);
1739+
source_location.set_function(function_identifier);
17361740

17371741
equal_exprt eq(
17381742
leak_expr,
@@ -1791,13 +1795,13 @@ void goto_checkt::goto_check(
17911795
}
17921796

17931797
void goto_check(
1798+
const irep_idt &function_identifier,
1799+
goto_functionst::goto_functiont &goto_function,
17941800
const namespacet &ns,
1795-
const optionst &options,
1796-
const irep_idt &mode,
1797-
goto_functionst::goto_functiont &goto_function)
1801+
const optionst &options)
17981802
{
17991803
goto_checkt goto_check(ns, options);
1800-
goto_check.goto_check(goto_function, mode);
1804+
goto_check.goto_check(function_identifier, goto_function);
18011805
}
18021806

18031807
void goto_check(
@@ -1811,8 +1815,7 @@ void goto_check(
18111815

18121816
Forall_goto_functions(it, goto_functions)
18131817
{
1814-
irep_idt mode=ns.lookup(it->first).mode;
1815-
goto_check.goto_check(it->second, mode);
1818+
goto_check.goto_check(it->first, it->second);
18161819
}
18171820
}
18181821

src/analyses/goto_check.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ void goto_check(
2424
goto_functionst &goto_functions);
2525

2626
void goto_check(
27+
const irep_idt &function_identifier,
28+
goto_functionst::goto_functiont &goto_function,
2729
const namespacet &ns,
28-
const optionst &options,
29-
const irep_idt &mode,
30-
goto_functionst::goto_functiont &goto_function);
30+
const optionst &options);
3131

3232
void goto_check(
3333
const optionst &options,

0 commit comments

Comments
 (0)