Skip to content

Commit a12831a

Browse files
committed
Implement changes to review comments in #167
1 parent ae9a21f commit a12831a

File tree

9 files changed

+21
-22
lines changed

9 files changed

+21
-22
lines changed

regression/goto-instrument/store_goto_locations/test.desc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ main.c
66
Original GOTO location
77
--
88
--
9-
This is tracked by the JIRA issue TYT-4: https://diffblue.atlassian.net/projects/TYT/issues/TYT-4

src/analyses/ai.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ xmlt ai_baset::output_xml(
233233
i_it->source_location.as_string());
234234
auto original_location = i_it->source_location.get_goto_location();
235235
if(original_location!="")
236+
{
236237
location.set_attribute(
237-
"originalGOTOLocation",
238+
"original_GOTO_Location",
238239
id2string(original_location));
240+
}
239241

240242
location.new_element(find_state(i_it).output_xml(*this, ns));
241243

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,9 @@ int goto_instrument_parse_optionst::doit()
436436

437437
if(cmdline.isset("store-goto-locations"))
438438
{
439-
Forall_goto_functions(it, goto_functions)
439+
for(auto &function : goto_functions.function_map)
440440
{
441-
auto &function_body = it->second.body;
442-
store_goto_locations(function_body);
441+
store_goto_locations(function.second.body);
443442
}
444443
}
445444

src/goto-instrument/store_goto_location.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
void store_goto_locations(goto_programt &goto_program)
77
{
8-
for (auto it=goto_program.instructions.begin();
9-
it!=goto_program.instructions.end();
10-
it++)
8+
for(auto it=goto_program.instructions.begin();
9+
it!=goto_program.instructions.end();
10+
it++)
1111
{
12-
auto &source_location = it->source_location;
13-
auto location_number = it->location_number;
12+
auto &source_location=it->source_location;
13+
auto location_number=it->location_number;
1414

15-
source_location.set_goto_location(location_number);
15+
source_location.set_goto_location(location_number);
1616
}
1717
}

src/goto-instrument/store_goto_location.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Date: August 2017
88
99
\*******************************************************************/
1010

11-
#ifndef STORE_GOTO_LOCATION_H
12-
#define STORE_GOTO_LOCATION_H
11+
#ifndef CPROVER_GOTO_INSTRUMENT_STORE_GOTO_LOCATION_H
12+
#define CPROVER_GOTO_INSTRUMENT_STORE_GOTO_LOCATION_H
1313

1414

1515
#include <goto-programs/goto_program.h>
1616

1717
void store_goto_locations(goto_programt &goto_program);
1818

19-
#endif // STORE_GOTO_LOCATION_H
19+
#endif // CPROVER_GOTO_INSTRUMENT_STORE_GOTO_LOCATION_H

src/goto-programs/goto_program.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,11 @@ std::ostream &goto_programt::output_instruction(
4848
std::ostream &out,
4949
const goto_program_templatet::instructiont &instruction) const
5050
{
51+
out << " // " << instruction.location_number << " ";
5152
auto original_location=instruction.source_location.get_goto_location();
5253
if(original_location!="")
5354
{
54-
out << " // " << instruction.location_number << " "
55-
<< "(Original GOTO location: " << original_location << ") ";
56-
}
57-
else
58-
{
59-
out << " // " << instruction.location_number << " ";
55+
out << "(Original GOTO location: " << original_location << ") ";
6056
}
6157

6258
if(!instruction.source_location.is_nil())

src/goto-programs/show_goto_functions_json.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ json_objectt show_goto_functions_jsont::convert(
6969
json(instruction.code.source_location());
7070

7171
if(instruction.code.source_location().get_goto_location()!="")
72+
{
7273
instruction_entry["originalGOTOLocation"]=
7374
json_stringt(id2string(instruction.code.source_location().get_goto_location()));
75+
}
7476
}
7577

7678
std::ostringstream instruction_builder;

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,7 @@ IREP_ID_ONE(cprover_string_to_upper_case_func)
810810
IREP_ID_ONE(cprover_string_trim_func)
811811
IREP_ID_ONE(cprover_string_value_of_func)
812812
IREP_ID_ONE(array_replace)
813+
IREP_ID_ONE(original_GOTO_location)
813814

814815
#undef IREP_ID_ONE
815816
#undef IREP_ID_TWO

src/util/source_location.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ class source_locationt:public irept
142142

143143
void set_goto_location(unsigned location)
144144
{
145-
set("GOTO_location", location);
145+
set(ID_original_GOTO_location, location);
146146
}
147147

148148
const irep_idt get_goto_location() const
149149
{
150-
return get("GOTO_location");
150+
return get(ID_original_GOTO_location);
151151
}
152152

153153
static bool is_built_in(const std::string &s)

0 commit comments

Comments
 (0)