Skip to content

Commit 7e57194

Browse files
author
owen-jones-diffblue
authored
Merge pull request diffblue#414 from diffblue/owen-jones-diffblue/remove-old-command-line-argument
Remove --lvsa-function command line argument
2 parents e6a922c + c887801 commit 7e57194

File tree

2 files changed

+50
-82
lines changed

2 files changed

+50
-82
lines changed

src/driver/sec_driver_parse_options.cpp

Lines changed: 49 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -241,100 +241,69 @@ int sec_driver_parse_optionst::doit()
241241
serializer(dbpath, id2string, get_message_handler());
242242
local_value_set_analysist::dbt summarydb(serializer, 30);
243243
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)
245259
{
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;
263265
const auto& gf=goto_model.goto_functions.function_map.at(fname);
266+
if(!gf.body_available())
267+
continue;
264268
class_hierarchyt class_hierarchy;
265269
class_hierarchy(goto_model.symbol_table);
266270
local_value_set_analysist value_set_analysis(
267-
ns, gf.type, fname, summarydb, class_hierarchy);
271+
ns, gf.type, id2string(fname), summarydb, class_hierarchy);
268272
value_set_analysis.set_message_handler(get_message_handler());
269273
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)
289276
{
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())
306278
{
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:
308287
{
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;
324291
}
292+
default:
293+
INVARIANT(false, "LVSA summary dump: UI type not handled");
325294
}
326-
if(dbpath.size()!=0)
327-
value_set_analysis.save_summary(gf.body);
328295
}
296+
if(dbpath.size()!=0)
297+
value_set_analysis.save_summary(gf.body);
298+
}
329299

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;
338307
}
339308
return CPROVER_EXIT_SUCCESS;
340309
}
@@ -553,7 +522,6 @@ void sec_driver_parse_optionst::help()
553522
" --json file_name output results in JSON format to given file\n"
554523
" --xml file_name output results in XML format to given file\n"
555524
" --function set main function name\n"
556-
" --lvsa-function set function to analyze with LVSA\n"
557525
" --lvsa-summary-directory directory to store LVSA summaries\n"
558526
"\n"
559527
"Java Bytecode frontend options:\n"

src/driver/sec_driver_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class optionst;
4040
"(intervals)(show-intervals)" \
4141
"(non-null)(show-non-null)" \
4242
"(lvsa-summary-directory):" \
43-
"(local-value-set-analysis)(show-value-sets-all)(show-value-sets)(lvsa-function):" \
43+
"(local-value-set-analysis)(show-value-sets-all)(show-value-sets)" \
4444
"(security-scanner):" \
4545
"(do-not-use-precise-access-paths)" \
4646
"(rebuild-taint-cache)" \

0 commit comments

Comments
 (0)