@@ -407,12 +407,23 @@ std::unique_ptr<generate_function_bodiest> generate_function_bodies_factory(
407
407
std::vector<irep_idt> globals_to_havoc;
408
408
namespacet ns (symbol_table);
409
409
messaget messages (message_handler);
410
+ const std::regex cprover_prefix = std::regex (" __CPROVER.*" );
410
411
for (auto const &symbol : symbol_table.symbols )
411
412
{
412
413
if (
413
414
symbol.second .is_lvalue && symbol.second .is_static_lifetime &&
414
415
std::regex_match (id2string (symbol.first ), globals_regex))
415
416
{
417
+ if (std::regex_match (id2string (symbol.first ), cprover_prefix))
418
+ {
419
+ messages.warning () << " generate function bodies: "
420
+ << " matched global '"
421
+ << id2string (symbol.first )
422
+ << " ' begins with __CPROVER, "
423
+ << " havoc-ing this global may interfere"
424
+ << " with analysis"
425
+ << messaget::eom;
426
+ }
416
427
globals_to_havoc.push_back (symbol.first );
417
428
}
418
429
}
@@ -465,21 +476,32 @@ void replace_function_bodies(
465
476
goto_modelt &model,
466
477
message_handlert &message_handler)
467
478
{
479
+ messaget messages (message_handler);
480
+ const std::regex cprover_prefix = std::regex (" __CPROVER.*" );
468
481
bool did_generate_body = false ;
469
482
for (auto &function : model.goto_functions .function_map )
470
483
{
471
484
if (
472
485
!function.second .body_available () &&
473
486
std::regex_match (id2string (function.first ), functions_regex))
474
487
{
488
+ if (std::regex_match (id2string (function.first ), cprover_prefix))
489
+ {
490
+ messages.warning ()
491
+ << " generate function bodies: matched function '"
492
+ << id2string (function.first )
493
+ << " ' begins with __CPROVER "
494
+ << " the generated body for this function "
495
+ << " may interfere with analysis"
496
+ << messaget::eom;
497
+ }
475
498
did_generate_body = true ;
476
499
generate_function_body.generate_function_body (
477
500
function.second , model.symbol_table , function.first );
478
501
}
479
502
}
480
503
if (!did_generate_body)
481
504
{
482
- messaget messages (message_handler);
483
505
messages.warning ()
484
506
<< " generate function bodies: No function name matched regex"
485
507
<< messaget::eom;
0 commit comments