@@ -8,6 +8,8 @@ Date: May 2016
8
8
9
9
\*******************************************************************/
10
10
11
+ #include < iostream>
12
+
11
13
#include < algorithm>
12
14
#include < iterator>
13
15
#include < unordered_set>
@@ -135,24 +137,33 @@ coverage_goalst coverage_goalst::get_coverage_goals(const std::string &coverage,
135
137
exit (0 );
136
138
}
137
139
138
- irep_idt line_number ;
140
+ irep_idt file, function, line ;
139
141
for (jsont::arrayt::const_iterator
140
142
it=json.array .begin ();
141
143
it!=json.array .end ();
142
144
it++)
143
145
{
144
- // get the goals array
145
- if ((*it)[" goals" ].is_array ())
146
+
147
+ // get the file of each existing goal
148
+ file=(*it)[" file" ].value ;
149
+ source_location.set_file (file);
150
+
151
+ // get the function of each existing goal
152
+ function=(*it)[" function" ].value ;
153
+ source_location.set_function (function);
154
+
155
+ // get the lines array
156
+ if ((*it)[" lines" ].is_array ())
146
157
{
147
158
for (jsont::arrayt::const_iterator
148
- itg=(*it)[" goals " ].array .begin ();
149
- itg!=(*it)[" goals " ].array .end ();
159
+ itg=(*it)[" lines " ].array .begin ();
160
+ itg!=(*it)[" lines " ].array .end ();
150
161
itg++)
151
162
{
152
163
// get the line of each existing goal
153
- line_number =(*itg)[" sourceLocation " ][ " line " ].value ;
154
- source_location.set_line (line_number );
155
- goals.set_goals (source_location);
164
+ line =(*itg)[" number " ].value ;
165
+ source_location.set_line (line );
166
+ goals.set_goals (source_location);
156
167
}
157
168
}
158
169
}
@@ -193,7 +204,9 @@ bool coverage_goalst::is_existing_goal(source_locationt source_location)
193
204
std::vector<source_locationt>::iterator it = existing_goals.begin ();
194
205
while (it!=existing_goals.end ())
195
206
{
196
- if (!source_location.get_line ().compare (it->get_line ()))
207
+ if (!source_location.get_file ().compare (it->get_file ()) &&
208
+ !source_location.get_function ().compare (it->get_function ()) &&
209
+ !source_location.get_line ().compare (it->get_line ()))
197
210
break ;
198
211
++it;
199
212
}
0 commit comments