@@ -933,15 +933,10 @@ void instrument_cover_goals(
933
933
source_locationt source_location=
934
934
basic_blocks.source_location_map [block_nr];
935
935
936
- <<<<<<< HEAD
937
- if (!source_location.get_file ().empty () &&
938
- !source_location.is_built_in ())
939
- =======
940
936
// check whether the current goal already exists
941
937
if (goals.is_existing_goal (source_location.get_line ().c_str ()) &&
942
- !source_location.get_file ().empty () &&
943
- source_location.get_file ()[0 ]!=' <' )
944
- >>>>>>> generate goals only if they do not exist in the json file
938
+ !source_location.get_file ().empty () &&
939
+ !source_location.is_built_in ())
945
940
{
946
941
std::string comment=" block " +b;
947
942
goto_program.insert_before_swap (i_it);
@@ -1200,80 +1195,20 @@ void instrument_cover_goals(
1200
1195
}
1201
1196
}
1202
1197
1203
- bool instrument_cover_goals (
1204
- const cmdlinet &cmdline,
1198
+ void instrument_cover_goals (
1205
1199
const symbol_tablet &symbol_table,
1206
1200
goto_functionst &goto_functions,
1207
- message_handlert &msgh )
1201
+ coverage_criteriont criterion )
1208
1202
{
1209
- messaget msg (msgh);
1210
- std::list<std::string> criteria_strings=cmdline.get_values (" cover" );
1211
- std::set<coverage_criteriont> criteria;
1212
- bool keep_assertions=false ;
1213
-
1214
- for (const auto &criterion_string : criteria_strings)
1215
- {
1216
- coverage_criteriont c;
1217
-
1218
- if (criterion_string==" assertion" || criterion_string==" assertions" )
1219
- {
1220
- keep_assertions=true ;
1221
- c=coverage_criteriont::ASSERTION;
1222
- }
1223
- else if (criterion_string==" path" || criterion_string==" paths" )
1224
- c=coverage_criteriont::PATH;
1225
- else if (criterion_string==" branch" || criterion_string==" branches" )
1226
- c=coverage_criteriont::BRANCH;
1227
- else if (criterion_string==" location" || criterion_string==" locations" )
1228
- c=coverage_criteriont::LOCATION;
1229
- else if (criterion_string==" decision" || criterion_string==" decisions" )
1230
- c=coverage_criteriont::DECISION;
1231
- else if (criterion_string==" condition" || criterion_string==" conditions" )
1232
- c=coverage_criteriont::CONDITION;
1233
- else if (criterion_string==" mcdc" )
1234
- c=coverage_criteriont::MCDC;
1235
- else if (criterion_string==" cover" )
1236
- c=coverage_criteriont::COVER;
1237
- else
1238
- {
1239
- msg.error () << " unknown coverage criterion "
1240
- << ' \' ' << criterion_string << ' \' '
1241
- << messaget::eom;
1242
- return true ;
1243
- }
1244
-
1245
- criteria.insert (c);
1246
- }
1247
-
1248
- if (keep_assertions && criteria_strings.size ()>1 )
1203
+ Forall_goto_functions (f_it, goto_functions)
1249
1204
{
1250
- msg.error () << " assertion coverage cannot currently be used together with "
1251
- << " other coverage criteria" << messaget::eom;
1252
- return true ;
1253
- }
1254
-
1255
- msg.status () << " Rewriting existing assertions as assumptions"
1256
- << messaget::eom;
1205
+ if (f_it->first ==ID__start ||
1206
+ f_it->first ==" __CPROVER_initialize" )
1207
+ continue ;
1257
1208
1258
- if (!keep_assertions)
1259
- {
1260
- // turn assertions (from generic checks) into assumptions
1261
- Forall_goto_functions (f_it, goto_functions)
1262
- {
1263
- goto_programt &body=f_it->second .body ;
1264
- Forall_goto_program_instructions (i_it, body)
1265
- {
1266
- if (i_it->is_assert ())
1267
- i_it->type =goto_program_instruction_typet::ASSUME;
1268
- }
1269
- }
1209
+ // empty set of existing goals
1210
+ coverage_goalst goals;
1211
+ instrument_cover_goals (symbol_table, f_it->second .body ,
1212
+ criterion, goals);
1270
1213
}
1271
-
1272
- msg.status () << " Instrumenting coverage goals" << messaget::eom;
1273
-
1274
- for (const auto &criterion : criteria)
1275
- instrument_cover_goals (symbol_table, goto_functions, criterion);
1276
-
1277
- goto_functions.update ();
1278
- return false ;
1279
1214
}
0 commit comments