Skip to content

Commit 08504ec

Browse files
committed
Use goto_programt::loop_id
This ensures we build loop identifiers in the same way everywhere.
1 parent f9891b9 commit 08504ec

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/goto-instrument/unwind.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ void goto_unwindt::unwind(
281281
const irep_idt func=i_it->function;
282282
assert(!func.empty());
283283

284-
const irep_idt loop_id=
285-
id2string(func) + "." + std::to_string(i_it->loop_number);
284+
const irep_idt loop_id = goto_programt::loop_id(func, *i_it);
286285

287286
auto limit=unwindset.get_limit(loop_id, 0);
288287

src/goto-programs/loop_ids.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ void show_loop_ids(
3636
{
3737
if(it->is_backwards_goto())
3838
{
39-
unsigned loop_id=it->loop_number;
40-
41-
std::cout << "Loop " << function_identifier << "." << loop_id << ":"
39+
std::cout << "Loop " << goto_programt::loop_id(function_identifier, *it) << ":"
4240
<< "\n";
4341

4442
std::cout << " " << it->source_location << "\n";
@@ -53,9 +51,7 @@ void show_loop_ids(
5351
{
5452
if(it->is_backwards_goto())
5553
{
56-
unsigned loop_id=it->loop_number;
57-
std::string id =
58-
id2string(function_identifier) + "." + std::to_string(loop_id);
54+
std::string id = id2string(goto_programt::loop_id(function_identifier, *it));
5955

6056
xmlt xml_loop("loop", {{"name", id}}, {});
6157
xml_loop.new_element("loop-id").data=id;
@@ -82,9 +78,7 @@ void show_loop_ids_json(
8278
{
8379
if(it->is_backwards_goto())
8480
{
85-
unsigned loop_id=it->loop_number;
86-
std::string id =
87-
id2string(function_identifier) + "." + std::to_string(loop_id);
81+
std::string id = id2string(goto_programt::loop_id(function_identifier, *it));
8882

8983
loops.push_back(
9084
json_objectt({{"name", json_stringt(id)},

0 commit comments

Comments
 (0)