@@ -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
@@ -105,24 +107,34 @@ coverage_goalst coverage_goalst::get_coverage_goals(const std::string &coverage,
105
107
exit (0 );
106
108
}
107
109
108
- irep_idt line_number ;
110
+ irep_idt file, function, line ;
109
111
for (jsont::arrayt::const_iterator
110
112
it=json.array .begin ();
111
113
it!=json.array .end ();
112
114
it++)
113
115
{
114
- // get the goals array
115
- if ((*it)[" goals" ].is_array ())
116
+
117
+ // get the file of each existing goal
118
+ file=(*it)[" file" ].value ;
119
+ source_location.set_file (file);
120
+
121
+ // get the function of each existing goal
122
+ function=(*it)[" function" ].value ;
123
+ source_location.set_function (function);
124
+
125
+ // get the lines array
126
+ if ((*it)[" lines" ].is_array ())
116
127
{
117
128
for (jsont::arrayt::const_iterator
118
- itg=(*it)[" goals " ].array .begin ();
119
- itg!=(*it)[" goals " ].array .end ();
129
+ itg=(*it)[" lines " ].array .begin ();
130
+ itg!=(*it)[" lines " ].array .end ();
120
131
itg++)
121
132
{
122
133
// get the line of each existing goal
123
- line_number =(*itg)[" sourceLocation " ][ " line " ].value ;
124
- source_location.set_line (line_number );
134
+ line =(*itg)[" number " ].value ;
135
+ source_location.set_line (line );
125
136
goals.set_goals (source_location);
137
+
126
138
}
127
139
}
128
140
}
@@ -163,7 +175,9 @@ bool coverage_goalst::is_existing_goal(source_locationt source_location)
163
175
std::vector<source_locationt>::iterator it = existing_goals.begin ();
164
176
while (it!=existing_goals.end ())
165
177
{
166
- if (!source_location.get_line ().compare (it->get_line ()))
178
+ if (!source_location.get_file ().compare (it->get_file ()) &&
179
+ !source_location.get_function ().compare (it->get_function ()) &&
180
+ !source_location.get_line ().compare (it->get_line ()))
167
181
break ;
168
182
++it;
169
183
}
0 commit comments