Skip to content

Commit af60734

Browse files
committed
Generate-function-bodies: generate a meaningful assertion
When using --generate-function-body with "assert-false" or "assert-false-assume-false" make sure we produce a more meaningful description than "assertion false." Instead, make the comment say "undefined function should be unreachable." Fixes: diffblue#6393
1 parent 8bf3ea6 commit af60734

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/goto-instrument/generate_function_bodies.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,8 @@ class assert_false_generate_function_bodiest : public generate_function_bodiest
105105
};
106106
auto assert_instruction =
107107
add_instruction(goto_programt::make_assertion(false_exprt()));
108-
const namespacet ns(symbol_table);
109-
std::ostringstream comment_stream;
110-
comment_stream << id2string(ID_assertion) << " "
111-
<< format(assert_instruction->condition());
112108
assert_instruction->source_location_nonconst().set_comment(
113-
comment_stream.str());
109+
"undefined function should be unreachable");
114110
assert_instruction->source_location_nonconst().set_property_class(
115111
ID_assertion);
116112
add_instruction(goto_programt::make_end_function());
@@ -136,12 +132,8 @@ class assert_false_then_assume_false_generate_function_bodiest
136132
};
137133
auto assert_instruction =
138134
add_instruction(goto_programt::make_assertion(false_exprt()));
139-
const namespacet ns(symbol_table);
140-
std::ostringstream comment_stream;
141-
comment_stream << id2string(ID_assertion) << " "
142-
<< format(assert_instruction->condition());
143135
assert_instruction->source_location_nonconst().set_comment(
144-
comment_stream.str());
136+
"undefined function should be unreachable");
145137
assert_instruction->source_location_nonconst().set_property_class(
146138
ID_assertion);
147139
add_instruction(goto_programt::make_assumption(false_exprt()));

0 commit comments

Comments
 (0)