Skip to content

Commit d93882d

Browse files
lucasccordeirotautschnig
authored andcommitted
a goal should be identified by a source_locationt
Signed-off-by: Lucas Cordeiro <[email protected]>
1 parent 9f7b844 commit d93882d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/goto-instrument/cover.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ class basic_blockst
100100
}
101101
};
102102

103+
bool coverage_goalst::is_existing_goal(source_locationt source_location)
104+
{
105+
std::vector<std::string>::iterator it;
106+
it = find (existing_goals.begin(), existing_goals.end(),
107+
source_location.get_line().c_str());
108+
109+
if(it == existing_goals.end())
110+
return true;
111+
else
112+
return false;
113+
}
114+
103115
const char *as_string(coverage_criteriont c)
104116
{
105117
switch(c)
@@ -934,7 +946,7 @@ void instrument_cover_goals(
934946
basic_blocks.source_location_map[block_nr];
935947

936948
//check whether the current goal already exists
937-
if(goals.is_existing_goal(source_location.get_line().c_str()) &&
949+
if(goals.is_existing_goal(source_location) &&
938950
!source_location.get_file().empty() &&
939951
!source_location.is_built_in())
940952
{

src/goto-instrument/cover.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class coverage_goalst
2323
{
2424
public:
2525
void set_goals(std::string goal);
26-
bool is_existing_goal(const char* goal);
26+
bool is_existing_goal(source_locationt source_location);
2727

2828
private:
2929
std::vector<std::string> existing_goals;

0 commit comments

Comments
 (0)