Skip to content

Commit 73980e4

Browse files
committed
Function pointer restrictions: simplify interface
Rather than requiring users to (necessarily!) make at least two calls, just process what users actually have available (a goto model and some command line options).
1 parent c0270a4 commit 73980e4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,12 +1029,7 @@ void goto_instrument_parse_optionst::instrument_goto_program()
10291029
{
10301030
label_function_pointer_call_sites(goto_model);
10311031

1032-
const auto function_pointer_restrictions =
1033-
function_pointer_restrictionst::from_options(
1034-
options, goto_model, log.get_message_handler());
1035-
1036-
restrict_function_pointers(
1037-
ui_message_handler, goto_model, function_pointer_restrictions);
1032+
restrict_function_pointers(ui_message_handler, goto_model, options);
10381033
}
10391034
}
10401035

src/goto-programs/restrict_function_pointers.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,13 @@ void function_pointer_restrictionst::typecheck_function_pointer_restrictions(
169169
void restrict_function_pointers(
170170
message_handlert &message_handler,
171171
goto_modelt &goto_model,
172-
const function_pointer_restrictionst &restrictions)
172+
const optionst &options)
173173
{
174+
const auto restrictions = function_pointer_restrictionst::from_options(
175+
options, goto_model, message_handler);
176+
if(restrictions.restrictions.empty())
177+
return;
178+
174179
for(auto &function_item : goto_model.goto_functions.function_map)
175180
{
176181
goto_functiont &goto_function = function_item.second;

src/goto-programs/restrict_function_pointers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,6 @@ class function_pointer_restrictionst
164164
void restrict_function_pointers(
165165
message_handlert &message_handler,
166166
goto_modelt &goto_model,
167-
const function_pointer_restrictionst &restrictions);
167+
const optionst &options);
168168

169169
#endif // CPROVER_GOTO_PROGRAMS_RESTRICT_FUNCTION_POINTERS_H

0 commit comments

Comments
 (0)