Skip to content

Commit c7c94b2

Browse files
committed
Use make_assumption/assertion wrappers
instead of instructiont constructor.
1 parent f931965 commit c7c94b2

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/analyses/goto_check.cpp

+9-18
Original file line numberDiff line numberDiff line change
@@ -1481,15 +1481,11 @@ void goto_checkt::add_guarded_property(
14811481

14821482
if(assertions.insert(guarded_expr).second)
14831483
{
1484-
goto_program_instruction_typet type=
1485-
enable_assert_to_assume?ASSUME:ASSERT;
1486-
1487-
goto_programt::targett t = new_code.add(goto_programt::instructiont(
1488-
static_cast<const codet &>(get_nil_irep()),
1489-
source_location,
1490-
type,
1491-
std::move(new_expr),
1492-
{}));
1484+
auto t = new_code.add(
1485+
enable_assert_to_assume ? goto_programt::make_assumption(
1486+
std::move(guarded_expr), source_location)
1487+
: goto_programt::make_assertion(
1488+
std::move(guarded_expr), source_location));
14931489

14941490
std::string source_expr_string;
14951491
get_language_from_mode(mode)->from_expr(src_expr, source_expr_string, ns);
@@ -1856,15 +1852,10 @@ void goto_checkt::goto_check(
18561852
{
18571853
if(std::find(i.labels.begin(), i.labels.end(), label)!=i.labels.end())
18581854
{
1859-
goto_program_instruction_typet type=
1860-
enable_assert_to_assume?ASSUME:ASSERT;
1861-
1862-
goto_programt::targett t = new_code.add(goto_programt::instructiont(
1863-
static_cast<const codet &>(get_nil_irep()),
1864-
i.source_location,
1865-
type,
1866-
false_exprt(),
1867-
{}));
1855+
auto t = new_code.add(
1856+
enable_assert_to_assume
1857+
? goto_programt::make_assumption(false_exprt{}, i.source_location)
1858+
: goto_programt::make_assertion(false_exprt{}, i.source_location));
18681859

18691860
t->source_location.set_property_class("error label");
18701861
t->source_location.set_comment("error label "+label);

0 commit comments

Comments
 (0)