Skip to content

Commit a2cd909

Browse files
authored
Merge pull request #935 from diffblue/bmc-result
BMC: return `property_checker_resultt`
2 parents f334106 + 6a49d99 commit a2cd909

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

src/ebmc/bmc.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,19 @@ void bmc_with_iterative_constraint_strengthening(
191191
}
192192
}
193193

194-
void bmc(
194+
property_checker_resultt bmc(
195195
std::size_t bound,
196196
bool convert_only,
197197
bool bmc_with_assumptions,
198198
const transition_systemt &transition_system,
199-
ebmc_propertiest &properties,
199+
const ebmc_propertiest &properties_in,
200200
const ebmc_solver_factoryt &solver_factory,
201201
message_handlert &message_handler)
202202
{
203-
messaget message(message_handler);
203+
// copy
204+
ebmc_propertiest properties = properties_in;
204205

206+
messaget message(message_handler);
205207
message.status() << "Generating Decision Problem" << messaget::eom;
206208

207209
// convert the transition system
@@ -299,4 +301,6 @@ void bmc(
299301
<< std::chrono::duration<double>(sat_stop_time - sat_start_time).count()
300302
<< messaget::eom;
301303
}
304+
305+
return property_checker_resultt{std::move(properties)};
302306
}

src/ebmc/bmc.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ Author: Daniel Kroening, [email protected]
1212
#ifndef EBMC_BMC_H
1313
#define EBMC_BMC_H
1414

15-
#include "ebmc_properties.h"
1615
#include "ebmc_solver_factory.h"
16+
#include "property_checker.h"
1717

1818
class exprt;
1919
class transition_systemt;
2020

2121
/// This is word-level BMC.
22-
void bmc(
22+
[[nodiscard]] property_checker_resultt bmc(
2323
std::size_t bound,
2424
bool convert_only,
2525
bool bmc_with_assumptions,
2626
const transition_systemt &,
27-
ebmc_propertiest &,
27+
const ebmc_propertiest &,
2828
const ebmc_solver_factoryt &,
2929
message_handlert &);
3030

src/ebmc/k_induction.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,16 @@ void k_inductiont::induction_base()
226226
{
227227
message.status() << "Induction Base" << messaget::eom;
228228

229-
bmc(
229+
auto result = bmc(
230230
k,
231231
false, // convert_only
232232
false, // bmc_with_assumptions
233233
transition_system,
234234
properties,
235235
solver_factory,
236236
message.get_message_handler());
237+
238+
properties.properties = std::move(result.properties);
237239
}
238240

239241
/*******************************************************************\

src/ebmc/property_checker.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Author: Daniel Kroening, [email protected]
3131
property_checker_resultt word_level_bmc(
3232
const cmdlinet &cmdline,
3333
const transition_systemt &transition_system,
34-
ebmc_propertiest &properties,
34+
const ebmc_propertiest &properties,
3535
message_handlert &message_handler)
3636
{
3737
auto solver_factory = ebmc_solver_factory(cmdline);
@@ -61,6 +61,8 @@ property_checker_resultt word_level_bmc(
6161
result=finish_word_level_bmc(solver);
6262
#endif
6363
}
64+
65+
return property_checker_resultt{properties};
6466
}
6567
else
6668
{
@@ -83,7 +85,7 @@ property_checker_resultt word_level_bmc(
8385

8486
bool bmc_with_assumptions = cmdline.isset("bmc-with-assumptions");
8587

86-
bmc(
88+
auto result = bmc(
8789
bound,
8890
convert_only,
8991
bmc_with_assumptions,
@@ -94,6 +96,8 @@ property_checker_resultt word_level_bmc(
9496

9597
if(convert_only)
9698
return property_checker_resultt::success();
99+
100+
return result;
97101
}
98102
}
99103

@@ -115,8 +119,6 @@ property_checker_resultt word_level_bmc(
115119
{
116120
return property_checker_resultt::error();
117121
}
118-
119-
return property_checker_resultt{properties};
120122
}
121123

122124
property_checker_resultt finish_bit_level_bmc(
@@ -394,7 +396,7 @@ property_checker_resultt engine_heuristic(
394396
// Now try BMC with bound 5, word-level
395397
message.status() << "Attempting BMC with bound 5" << messaget::eom;
396398

397-
bmc(
399+
auto bmc_result = bmc(
398400
5, // bound
399401
false, // convert_only
400402
cmdline.isset("bmc-with-assumptions"),
@@ -403,6 +405,8 @@ property_checker_resultt engine_heuristic(
403405
solver_factory,
404406
message_handler);
405407

408+
properties.properties = std::move(bmc_result.properties);
409+
406410
if(!properties.has_unfinished_property())
407411
return property_checker_resultt{properties}; // done
408412

0 commit comments

Comments
 (0)