Skip to content

Commit c1c4430

Browse files
authored
Merge pull request #5566 from tautschnig/remove-deprecated-instructiont
Remove deprecated goto_programt::instructiont methods
2 parents 2482138 + e605bb4 commit c1c4430

File tree

4 files changed

+12
-115
lines changed

4 files changed

+12
-115
lines changed

src/goto-instrument/value_set_fi_fp_removal.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ void remove_function_pointer(
112112

113113
// the final target is a skip
114114
goto_programt final_skip;
115-
116-
goto_programt::targett t_final = final_skip.add_instruction();
117-
t_final->make_skip();
115+
goto_programt::targett t_final = final_skip.add(goto_programt::make_skip());
118116

119117
// build the calls and gotos
120118

@@ -124,8 +122,8 @@ void remove_function_pointer(
124122
for(const auto &fun : functions)
125123
{
126124
// call function
127-
goto_programt::targett t1 = new_code_calls.add_instruction();
128-
t1->make_function_call(code);
125+
goto_programt::targett t1 =
126+
new_code_calls.add(goto_programt::make_function_call(code));
129127
to_code_function_call(t1->code).function() = fun;
130128

131129
// the signature of the function might not match precisely
@@ -135,21 +133,20 @@ void remove_function_pointer(
135133
to_code_function_call(t1->code), new_code_calls, goto_model);
136134

137135
// goto final
138-
goto_programt::targett t3 = new_code_calls.add_instruction();
139-
t3->make_goto(t_final, true_exprt());
136+
new_code_calls.add(goto_programt::make_goto(t_final, true_exprt()));
140137

141138
// goto to call
142139
address_of_exprt address_of(fun, pointer_type(fun.type()));
143140

144-
goto_programt::targett t4 = new_code_gotos.add_instruction();
145-
t4->make_goto(
141+
new_code_gotos.add(goto_programt::make_goto(
146142
t1,
147143
equal_exprt(
148-
pointer, typecast_exprt::conditional_cast(address_of, pointer.type())));
144+
pointer,
145+
typecast_exprt::conditional_cast(address_of, pointer.type()))));
149146
}
150147

151-
goto_programt::targett t = new_code_gotos.add_instruction();
152-
t->make_assertion(false_exprt());
148+
goto_programt::targett t =
149+
new_code_gotos.add(goto_programt::make_assertion(false_exprt()));
153150
t->source_location.set_property_class("pointer dereference");
154151
t->source_location.set_comment("invalid function pointer");
155152

src/goto-programs/goto_program.h

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -353,77 +353,6 @@ class goto_programt
353353
clear(SKIP);
354354
}
355355

356-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_return() instead"))
357-
void make_return() { clear(RETURN); }
358-
359-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_skip() instead"))
360-
void make_skip() { clear(SKIP); }
361-
362-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_location() instead"))
363-
void make_location(const source_locationt &l)
364-
{ clear(LOCATION); source_location=l; }
365-
366-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_throw() instead"))
367-
void make_throw() { clear(THROW); }
368-
369-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_catch() instead"))
370-
void make_catch() { clear(CATCH); }
371-
372-
DEPRECATED(
373-
SINCE(2019, 2, 13, "use goto_programt::make_assertion() instead"))
374-
void make_assertion(const exprt &g) { clear(ASSERT); guard=g; }
375-
376-
DEPRECATED(
377-
SINCE(2019, 2, 13, "use goto_programt::make_assumption() instead"))
378-
void make_assumption(const exprt &g) { clear(ASSUME); guard=g; }
379-
380-
DEPRECATED(
381-
SINCE(2019, 2, 13, "use goto_programt::make_assignment() instead"))
382-
void make_assignment() { clear(ASSIGN); }
383-
384-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_other() instead"))
385-
void make_other(const codet &_code) { clear(OTHER); code=_code; }
386-
387-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_decl() instead"))
388-
void make_decl() { clear(DECL); }
389-
390-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_dead() instead"))
391-
void make_dead() { clear(DEAD); }
392-
393-
DEPRECATED(
394-
SINCE(2019, 2, 13, "use goto_programt::make_atomic_begin() instead"))
395-
void make_atomic_begin() { clear(ATOMIC_BEGIN); }
396-
397-
DEPRECATED(
398-
SINCE(2019, 2, 13, "use goto_programt::make_atomic_end() instead"))
399-
void make_atomic_end() { clear(ATOMIC_END); }
400-
401-
DEPRECATED(
402-
SINCE(2019, 2, 13, "use goto_programt::make_end_function() instead"))
403-
void make_end_function() { clear(END_FUNCTION); }
404-
405-
DEPRECATED(
406-
SINCE(2019, 2, 13, "use goto_programt::make_incomplete_goto() instead"))
407-
void make_incomplete_goto(const code_gotot &_code)
408-
{
409-
clear(INCOMPLETE_GOTO);
410-
code = _code;
411-
}
412-
413-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_goto() instead"))
414-
void make_goto(targett _target)
415-
{
416-
clear(GOTO);
417-
targets.push_back(_target);
418-
}
419-
420-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_goto() instead"))
421-
void make_goto(targett _target, const exprt &g)
422-
{
423-
make_goto(_target);
424-
guard=g;
425-
}
426-
427356
void complete_goto(targett _target)
428357
{
429358
PRECONDITION(type == INCOMPLETE_GOTO);
@@ -432,29 +361,6 @@ class goto_programt
432361
type = GOTO;
433362
}
434363

435-
DEPRECATED(
436-
SINCE(2019, 2, 13, "use goto_programt::make_assignment() instead"))
437-
void make_assignment(const code_assignt &_code)
438-
{
439-
clear(ASSIGN);
440-
code=_code;
441-
}
442-
443-
DEPRECATED(SINCE(2019, 2, 13, "use goto_programt::make_decl() instead"))
444-
void make_decl(const code_declt &_code)
445-
{
446-
clear(DECL);
447-
code=_code;
448-
}
449-
450-
DEPRECATED(
451-
SINCE(2019, 2, 13, "use goto_programt::make_function_call() instead"))
452-
void make_function_call(const code_function_callt &_code)
453-
{
454-
clear(FUNCTION_CALL);
455-
code=_code;
456-
}
457-
458364
bool is_goto () const { return type==GOTO; }
459365
bool is_return () const { return type==RETURN; }
460366
bool is_assign () const { return type==ASSIGN; }

unit/goto-programs/goto_program_table_consistency.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ SCENARIO(
3232
binary_relation_exprt x_le_10(varx, ID_le, val10);
3333

3434
goto_functiont goto_function;
35-
auto &instructions = goto_function.body.instructions;
36-
instructions.emplace_back(goto_programt::make_assertion(x_le_10));
35+
goto_function.body.add(goto_programt::make_assertion(x_le_10));
3736

3837
// required as goto_function.validate checks (if a function has a body) that
3938
// the last instruction of a function body marks the function's end.
40-
goto_programt::instructiont end_function_instruction;
41-
end_function_instruction.make_end_function();
42-
instructions.push_back(end_function_instruction);
39+
goto_function.body.add(goto_programt::make_end_function());
4340

4441
symbol_table.insert(function_symbol);
4542
WHEN("Symbol table has the right symbol")

unit/goto-programs/goto_program_validate.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,10 @@ SCENARIO("Validation of a goto program", "[core][goto-programs][validate]")
193193
{
194194
goto_convert(goto_model, null_message_handler);
195195

196-
goto_programt::instructiont instruction;
197-
instruction.make_return();
198-
199196
auto &function_map = goto_model.goto_functions.function_map;
200197
auto it = function_map.find("g");
201198
auto &instructions = it->second.body.instructions;
202-
instructions.insert(instructions.begin(), instruction);
199+
instructions.insert(instructions.begin(), goto_programt::make_return());
203200

204201
goto_model_validation_optionst validation_options{
205202
goto_model_validation_optionst ::set_optionst::all_false};

0 commit comments

Comments
 (0)