Skip to content

Commit cc1c44c

Browse files
author
Daniel Kroening
committed
show_loop_ids now gets function identifier
1 parent b067a34 commit cc1c44c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/goto-programs/loop_ids.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ void show_loop_ids(
2727

2828
void show_loop_ids(
2929
ui_message_handlert::uit ui,
30+
const irep_idt &function_identifier,
3031
const goto_programt &goto_program)
3132
{
3233
switch(ui)
@@ -39,8 +40,8 @@ void show_loop_ids(
3940
{
4041
unsigned loop_id=it->loop_number;
4142

42-
std::cout << "Loop "
43-
<< it->function << "." << loop_id << ":" << "\n";
43+
std::cout << "Loop " << function_identifier << "." << loop_id << ":"
44+
<< "\n";
4445

4546
std::cout << " " << it->source_location << "\n";
4647
std::cout << "\n";
@@ -55,7 +56,8 @@ void show_loop_ids(
5556
if(it->is_backwards_goto())
5657
{
5758
unsigned loop_id=it->loop_number;
58-
std::string id=id2string(it->function)+"."+std::to_string(loop_id);
59+
std::string id =
60+
id2string(function_identifier) + "." + std::to_string(loop_id);
5961

6062
xmlt xml_loop("loop");
6163
xml_loop.set_attribute("name", id);
@@ -73,6 +75,7 @@ void show_loop_ids(
7375

7476
void show_loop_ids_json(
7577
ui_message_handlert::uit ui,
78+
const irep_idt &function_identifier,
7679
const goto_programt &goto_program,
7780
json_arrayt &loops)
7881
{
@@ -83,7 +86,8 @@ void show_loop_ids_json(
8386
if(it->is_backwards_goto())
8487
{
8588
unsigned loop_id=it->loop_number;
86-
std::string id=id2string(it->function)+"."+std::to_string(loop_id);
89+
std::string id =
90+
id2string(function_identifier) + "." + std::to_string(loop_id);
8791

8892
json_objectt &loop=loops.push_back().make_object();
8993
loop["name"]=json_stringt(id);
@@ -101,15 +105,15 @@ void show_loop_ids(
101105
case ui_message_handlert::uit::PLAIN:
102106
case ui_message_handlert::uit::XML_UI:
103107
for(const auto &f: goto_functions.function_map)
104-
show_loop_ids(ui, f.second.body);
108+
show_loop_ids(ui, f.first, f.second.body);
105109
break;
106110

107111
case ui_message_handlert::uit::JSON_UI:
108112
json_objectt json_result;
109113
json_arrayt &loops=json_result["loops"].make_array();
110114

111115
for(const auto &f : goto_functions.function_map)
112-
show_loop_ids_json(ui, f.second.body, loops);
116+
show_loop_ids_json(ui, f.first, f.second.body, loops);
113117

114118
std::cout << ",\n" << json_result;
115119
break;

src/goto-programs/loop_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void show_loop_ids(
2626

2727
void show_loop_ids(
2828
ui_message_handlert::uit,
29+
const irep_idt &function_identifier,
2930
const goto_programt &);
3031

3132
#endif // CPROVER_GOTO_PROGRAMS_LOOP_IDS_H

0 commit comments

Comments
 (0)