@@ -241,100 +241,69 @@ int sec_driver_parse_optionst::doit()
241
241
serializer (dbpath, id2string, get_message_handler ());
242
242
local_value_set_analysist::dbt summarydb (serializer, 30 );
243
243
namespacet ns (goto_model.symbol_table );
244
- if (cmdline.isset (" lvsa-function" ))
244
+
245
+ const std::string function_name = cmdline.get_value (" function" );
246
+ const bool print_function_summary = cmdline.isset (" show-value-sets" );
247
+ const bool print_all_summaries = cmdline.isset (" show-value-sets-all" );
248
+
249
+ irep_idt fully_qualified_name =
250
+ get_cprover_start_main_callee (goto_model);
251
+
252
+ call_grapht const call_graph (goto_model.goto_functions );
253
+ std::vector<irep_idt> process_order =
254
+ get_inverse_topological_order (call_graph.get_directed_graph ());
255
+ size_t total_funcs=process_order.size ();
256
+ size_t processed=0 ;
257
+ json_objectt json_function_descriptions;
258
+ for (const auto & fname : process_order)
245
259
{
246
- const auto & fname=cmdline.get_value (" lvsa-function" );
247
- if (goto_model.goto_functions .function_map .count (fname) == 0 )
248
- {
249
- error ()
250
- << " Function '" << fname
251
- << " ' specified as lvsa-function could not be found" << eom;
252
- debug () << " Available functions include:\n " ;
253
- int fnCount = 10 ;
254
- for (auto &f : goto_model.goto_functions .function_map )
255
- {
256
- if (fnCount-- == 0 )
257
- break ;
258
- debug () << " " << f.first .c_str () << " \n " ;
259
- }
260
- debug () << eom;
261
- return CPROVER_EXIT_INCORRECT_TASK;
262
- }
260
+ ++processed;
261
+ if (fname==" _start" )
262
+ continue ;
263
+ progress () << " LVSA: analysing " << fname
264
+ << " [" << processed << " /" << total_funcs << " ]" << eom;
263
265
const auto & gf=goto_model.goto_functions .function_map .at (fname);
266
+ if (!gf.body_available ())
267
+ continue ;
264
268
class_hierarchyt class_hierarchy;
265
269
class_hierarchy (goto_model.symbol_table );
266
270
local_value_set_analysist value_set_analysis (
267
- ns, gf.type , fname, summarydb, class_hierarchy);
271
+ ns, gf.type , id2string ( fname) , summarydb, class_hierarchy);
268
272
value_set_analysis.set_message_handler (get_message_handler ());
269
273
value_set_analysis (gf.body );
270
- value_set_analysis.output (gf.body , std::cout);
271
- if (dbpath.size ()!=0 )
272
- value_set_analysis.save_summary (gf.body );
273
- }
274
- else {
275
- const std::string function_name = cmdline.get_value (" function" );
276
- const bool print_function_summary = cmdline.isset (" show-value-sets" );
277
- const bool print_all_summaries = cmdline.isset (" show-value-sets-all" );
278
-
279
- irep_idt fully_qualified_name =
280
- get_cprover_start_main_callee (goto_model);
281
-
282
- call_grapht const call_graph (goto_model.goto_functions );
283
- std::vector<irep_idt> process_order =
284
- get_inverse_topological_order (call_graph.get_directed_graph ());
285
- size_t total_funcs=process_order.size ();
286
- size_t processed=0 ;
287
- json_objectt json_function_descriptions;
288
- for (const auto & fname : process_order)
274
+
275
+ if ((print_function_summary && fname == fully_qualified_name) || print_all_summaries)
289
276
{
290
- ++processed;
291
- if (fname==" _start" )
292
- continue ;
293
- progress () << " LVSA: analysing " << fname
294
- << " [" << processed << " /" << total_funcs << " ]" << eom;
295
- const auto & gf=goto_model.goto_functions .function_map .at (fname);
296
- if (!gf.body_available ())
297
- continue ;
298
- class_hierarchyt class_hierarchy;
299
- class_hierarchy (goto_model.symbol_table );
300
- local_value_set_analysist value_set_analysis (
301
- ns, gf.type , id2string (fname), summarydb, class_hierarchy);
302
- value_set_analysis.set_message_handler (get_message_handler ());
303
- value_set_analysis (gf.body );
304
-
305
- if ((print_function_summary && fname == fully_qualified_name) || print_all_summaries)
277
+ switch (get_ui ())
306
278
{
307
- switch (get_ui ())
279
+ case ui_message_handlert::uit::PLAIN:
280
+ {
281
+ status () << " *** function " << fname << ' \n ' ;
282
+ value_set_analysis.output (gf.body , status ());
283
+ status () << eom;
284
+ break ;
285
+ }
286
+ case ui_message_handlert::uit::JSON_UI:
308
287
{
309
- case ui_message_handlert::uit::PLAIN:
310
- {
311
- status () << " *** function " << fname << ' \n ' ;
312
- value_set_analysis.output (gf.body , status ());
313
- status () << eom;
314
- break ;
315
- }
316
- case ui_message_handlert::uit::JSON_UI:
317
- {
318
- json_function_descriptions[id2string (fname)]=
319
- value_set_analysis.output_json (gf.body );
320
- break ;
321
- }
322
- default :
323
- INVARIANT (false , " LVSA summary dump: UI type not handled" );
288
+ json_function_descriptions[id2string (fname)]=
289
+ value_set_analysis.output_json (gf.body );
290
+ break ;
324
291
}
292
+ default :
293
+ INVARIANT (false , " LVSA summary dump: UI type not handled" );
325
294
}
326
- if (dbpath.size ()!=0 )
327
- value_set_analysis.save_summary (gf.body );
328
295
}
296
+ if (dbpath.size ()!=0 )
297
+ value_set_analysis.save_summary (gf.body );
298
+ }
329
299
330
- if ((print_function_summary || print_all_summaries) &&
331
- get_ui ()==ui_message_handlert::uit::JSON_UI)
332
- {
333
- json_objectt dump_message;
334
- dump_message[" messageType" ]=json_stringt (" LVSA-ALL-FUNCTIONS-DUMP" );
335
- dump_message[" functions" ]=json_function_descriptions;
336
- status () << dump_message << eom;
337
- }
300
+ if ((print_function_summary || print_all_summaries) &&
301
+ get_ui ()==ui_message_handlert::uit::JSON_UI)
302
+ {
303
+ json_objectt dump_message;
304
+ dump_message[" messageType" ]=json_stringt (" LVSA-ALL-FUNCTIONS-DUMP" );
305
+ dump_message[" functions" ]=json_function_descriptions;
306
+ status () << dump_message << eom;
338
307
}
339
308
return CPROVER_EXIT_SUCCESS;
340
309
}
@@ -553,7 +522,6 @@ void sec_driver_parse_optionst::help()
553
522
" --json file_name output results in JSON format to given file\n "
554
523
" --xml file_name output results in XML format to given file\n "
555
524
" --function set main function name\n "
556
- " --lvsa-function set function to analyze with LVSA\n "
557
525
" --lvsa-summary-directory directory to store LVSA summaries\n "
558
526
" \n "
559
527
" Java Bytecode frontend options:\n "
0 commit comments