Skip to content

Commit c64e9f7

Browse files
authored
Merge pull request #7693 from tautschnig/cleanup/nesting-graph-loopt
Cleanup the API of dfcc_loop_nesting_grapht
2 parents 18bbc32 + fe428ad commit c64e9f7

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

src/analyses/loop_analysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Author: Diffblue Ltd
1313
#ifndef CPROVER_ANALYSES_LOOP_ANALYSIS_H
1414
#define CPROVER_ANALYSES_LOOP_ANALYSIS_H
1515

16-
#include <memory>
16+
#include <goto-programs/goto_model.h>
1717

1818
template <class T>
1919
class loop_analysist;

src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,16 +522,15 @@ dfcc_cfg_infot::dfcc_cfg_infot(
522522
: function_id(function_id),
523523
goto_function(goto_function),
524524
top_level_write_set(top_level_write_set),
525-
log(message_handler),
526525
ns(symbol_table)
527526
{
528527
dfcc_loop_nesting_grapht loop_nesting_graph;
529528
goto_programt &goto_program = goto_function.body;
530-
messaget log(message_handler);
531529
if(loop_contract_mode != dfcc_loop_contract_modet::NONE)
532530
{
531+
messaget log(message_handler);
533532
dfcc_check_loop_normal_form(goto_program, log);
534-
loop_nesting_graph = build_loop_nesting_graph(goto_program, log);
533+
loop_nesting_graph = build_loop_nesting_graph(goto_program);
535534

536535
const auto head = check_inner_loops_have_contracts(loop_nesting_graph);
537536
if(head.has_value())

src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Date: March 2023
1717
#ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_CFG_INFO_H
1818
#define CPROVER_GOTO_INSTRUMENT_CONTRACTS_DYNAMIC_FRAMES_DFCC_CFG_INFO_H
1919

20-
#include <util/message.h>
2120
#include <util/namespace.h>
2221
#include <util/std_expr.h>
2322
#include <util/symbol_table.h>
@@ -33,6 +32,7 @@ Date: March 2023
3332
class dfcc_utilst;
3433
class dfcc_libraryt;
3534
class goto_functiont;
35+
class message_handlert;
3636

3737
/// \brief Describes a single loop for the purpose of DFCC loop contract
3838
/// instrumentation.
@@ -297,7 +297,6 @@ class dfcc_cfg_infot
297297
const irep_idt &function_id;
298298
goto_functiont &goto_function;
299299
const exprt &top_level_write_set;
300-
messaget log;
301300
const namespacet ns;
302301

303302
/// True iff \p id is in the valid range for a loop id or is equal to

src/goto-instrument/contracts/dynamic-frames/dfcc_loop_nesting_graph.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ Date: March 2023
1212

1313
#include "dfcc_loop_nesting_graph.h"
1414

15-
#include <util/invariant.h>
16-
#include <util/message.h>
15+
#include <analyses/natural_loops.h>
1716

1817
dfcc_loop_nesting_graph_nodet::dfcc_loop_nesting_graph_nodet(
1918
const goto_programt::targett &head,
2019
const goto_programt::targett &latch,
21-
const loopt &instructions)
20+
const loop_templatet<goto_programt::targett> &instructions)
2221
: head(head), latch(latch), instructions(instructions)
2322
{
2423
}
2524

2625
/// \pre Loop normal form properties must hold.
27-
dfcc_loop_nesting_grapht
28-
build_loop_nesting_graph(goto_programt &goto_program, messaget &log)
26+
dfcc_loop_nesting_grapht build_loop_nesting_graph(goto_programt &goto_program)
2927
{
3028
natural_loops_mutablet natural_loops(goto_program);
3129
dfcc_loop_nesting_grapht loop_nesting_graph;

src/goto-instrument/contracts/dynamic-frames/dfcc_loop_nesting_graph.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Date: March 2023
1818

1919
#include <util/graph.h>
2020

21-
#include <goto-instrument/loop_utils.h>
21+
#include <analyses/loop_analysis.h>
2222

2323
class messaget;
2424

@@ -29,7 +29,7 @@ struct dfcc_loop_nesting_graph_nodet : public graph_nodet<empty_edget>
2929
dfcc_loop_nesting_graph_nodet(
3030
const goto_programt::targett &head,
3131
const goto_programt::targett &latch,
32-
const loopt &instructions);
32+
const loop_templatet<goto_programt::targett> &instructions);
3333

3434
/// Loop head instruction
3535
goto_programt::targett head;
@@ -38,7 +38,7 @@ struct dfcc_loop_nesting_graph_nodet : public graph_nodet<empty_edget>
3838
goto_programt::targett latch;
3939

4040
/// Set of loop instructions
41-
loopt instructions;
41+
loop_templatet<goto_programt::targett> instructions;
4242
};
4343

4444
typedef grapht<dfcc_loop_nesting_graph_nodet> dfcc_loop_nesting_grapht;
@@ -47,6 +47,6 @@ typedef grapht<dfcc_loop_nesting_graph_nodet> dfcc_loop_nesting_grapht;
4747
/// loops in the given \p goto_program.
4848
/// A loop is considered nested in an outer loop if its head and its latch are
4949
/// both found in the instructions of the outer loop.
50-
dfcc_loop_nesting_grapht
51-
build_loop_nesting_graph(goto_programt &goto_program, messaget &log);
50+
dfcc_loop_nesting_grapht build_loop_nesting_graph(goto_programt &goto_program);
51+
5252
#endif

0 commit comments

Comments
 (0)