Skip to content

Commit 12d6582

Browse files
Ignore built-in functions and instructions inlined from built-ins during cover instrumentation
fixes #259
1 parent c393197 commit 12d6582

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/goto-instrument/cover.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ Function: eval_expr
684684
the atomic expr values
685685
686686
\*******************************************************************/
687+
687688
bool eval_expr(
688689
const std::map<exprt, signed> &atomic_exprs,
689690
const exprt &src)
@@ -1141,7 +1142,7 @@ void instrument_cover_goals(
11411142
basic_blocks.source_location_map[block_nr];
11421143

11431144
if(!source_location.get_file().empty() &&
1144-
source_location.get_file()[0]!='<')
1145+
!source_location.is_built_in())
11451146
{
11461147
std::string comment="block "+b;
11471148
goto_program.insert_before_swap(i_it);
@@ -1179,7 +1180,8 @@ void instrument_cover_goals(
11791180
t->source_location.set_property_class(property_class);
11801181
}
11811182

1182-
if(i_it->is_goto() && !i_it->guard.is_true())
1183+
if(i_it->is_goto() && !i_it->guard.is_true() &&
1184+
!i_it->source_location.is_built_in())
11831185
{
11841186
std::string b=std::to_string(basic_blocks[i_it]);
11851187
std::string true_comment=
@@ -1214,6 +1216,7 @@ void instrument_cover_goals(
12141216
i_it->make_skip();
12151217

12161218
// Conditions are all atomic predicates in the programs.
1219+
if(!i_it->source_location.is_built_in())
12171220
{
12181221
const std::set<exprt> conditions=collect_conditions(i_it);
12191222

@@ -1250,6 +1253,7 @@ void instrument_cover_goals(
12501253
i_it->make_skip();
12511254

12521255
// Decisions are maximal Boolean combinations of conditions.
1256+
if(!i_it->source_location.is_built_in())
12531257
{
12541258
const std::set<exprt> decisions=collect_decisions(i_it);
12551259

@@ -1290,6 +1294,7 @@ void instrument_cover_goals(
12901294
// 3. Each condition in a decision takes every possible outcome
12911295
// 4. Each condition in a decision is shown to independently
12921296
// affect the outcome of the decision.
1297+
if(!i_it->source_location.is_built_in())
12931298
{
12941299
const std::set<exprt> conditions=collect_conditions(i_it);
12951300
const std::set<exprt> decisions=collect_decisions(i_it);
@@ -1392,7 +1397,8 @@ void instrument_cover_goals(
13921397
Forall_goto_functions(f_it, goto_functions)
13931398
{
13941399
if(f_it->first==goto_functions.entry_point() ||
1395-
f_it->first=="__CPROVER_initialize")
1400+
f_it->first=="__CPROVER_initialize" ||
1401+
f_it->second.is_hidden())
13961402
continue;
13971403

13981404
instrument_cover_goals(symbol_table, f_it->second.body, criterion);

0 commit comments

Comments
 (0)