@@ -127,24 +127,33 @@ coverage_goalst coverage_goalst::get_coverage_goals(const std::string &coverage,
127
127
exit (0 );
128
128
}
129
129
130
- irep_idt line_number ;
130
+ irep_idt file, function, line ;
131
131
for (jsont::arrayt::const_iterator
132
132
it=json.array .begin ();
133
133
it!=json.array .end ();
134
134
it++)
135
135
{
136
- // get the goals array
137
- if ((*it)[" goals" ].is_array ())
136
+
137
+ // get the file of each existing goal
138
+ file=(*it)[" file" ].value ;
139
+ source_location.set_file (file);
140
+
141
+ // get the function of each existing goal
142
+ function=(*it)[" function" ].value ;
143
+ source_location.set_function (function);
144
+
145
+ // get the lines array
146
+ if ((*it)[" lines" ].is_array ())
138
147
{
139
148
for (jsont::arrayt::const_iterator
140
- itg=(*it)[" goals " ].array .begin ();
141
- itg!=(*it)[" goals " ].array .end ();
149
+ itg=(*it)[" lines " ].array .begin ();
150
+ itg!=(*it)[" lines " ].array .end ();
142
151
itg++)
143
152
{
144
153
// get the line of each existing goal
145
- line_number =(*itg)[" sourceLocation " ][ " line " ].value ;
146
- source_location.set_line (line_number );
147
- goals.set_goals (source_location);
154
+ line =(*itg)[" number " ].value ;
155
+ source_location.set_line (line );
156
+ goals.set_goals (source_location);
148
157
}
149
158
}
150
159
}
@@ -156,7 +165,9 @@ bool coverage_goalst::is_existing_goal(source_locationt source_location)
156
165
std::vector<source_locationt>::iterator it = existing_goals.begin ();
157
166
while (it!=existing_goals.end ())
158
167
{
159
- if (!source_location.get_line ().compare (it->get_line ()))
168
+ if (!source_location.get_file ().compare (it->get_file ()) &&
169
+ !source_location.get_function ().compare (it->get_function ()) &&
170
+ !source_location.get_line ().compare (it->get_line ()))
160
171
break ;
161
172
++it;
162
173
}
0 commit comments