Skip to content

Commit 913de98

Browse files
check for java bytecode index in the existing coverage
check whether the java bytecode index matches for the existing coverage goals.
1 parent 71ace43 commit 913de98

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/goto-instrument/cover.cpp

+11-5
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,20 @@ void coverage_goalst::add_goal(source_locationt goal)
161161
existing_goals.push_back(goal);
162162
}
163163

164-
bool coverage_goalst::is_existing_goal(source_locationt source_location) const
164+
/// compare the value of the current goal to the existing ones
165+
/// \param source_loc: source location of the current goal
166+
/// \return true : if the current goal exists false : otherwise
167+
bool coverage_goalst::is_existing_goal(source_locationt source_loc) const
165168
{
166169
for(const auto &existing_loc : existing_goals)
167170
{
168-
if(source_location.get_file()==existing_loc.get_file() &&
169-
source_location.get_function()==existing_loc.get_function() &&
170-
source_location.get_line()==existing_loc.get_line())
171-
return true;
171+
if((source_loc.get_file()==existing_loc.get_file()) &&
172+
(source_loc.get_function()==existing_loc.get_function()) &&
173+
(source_loc.get_line()==existing_loc.get_line()) &&
174+
(source_loc.get_java_bytecode_index().empty() ||
175+
(source_loc.get_java_bytecode_index()==
176+
existing_loc.get_java_bytecode_index())))
177+
return true;
172178
}
173179
return false;
174180
}

src/goto-instrument/cover.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class coverage_goalst
2525
message_handlert &message_handler,
2626
coverage_goalst &goals);
2727
void add_goal(source_locationt goal);
28-
bool is_existing_goal(source_locationt source_location) const;
28+
bool is_existing_goal(source_locationt source_loc) const;
2929

3030
private:
3131
std::vector<source_locationt> existing_goals;

0 commit comments

Comments
 (0)