|
100 | 100 | #include "undefined_functions.h"
|
101 | 101 | #include "remove_function.h"
|
102 | 102 | #include "splice_call.h"
|
| 103 | +#include "replace_function_bodies.h" |
103 | 104 |
|
104 | 105 | void goto_instrument_parse_optionst::eval_verbosity()
|
105 | 106 | {
|
@@ -1448,6 +1449,30 @@ void goto_instrument_parse_optionst::instrument_goto_program()
|
1448 | 1449 | throw 0;
|
1449 | 1450 | }
|
1450 | 1451 |
|
| 1452 | + if( |
| 1453 | + cmdline.isset("replace-function-body") || |
| 1454 | + cmdline.isset("generate-function-body")) |
| 1455 | + { |
| 1456 | + if( |
| 1457 | + cmdline.isset("replace-function-body") && |
| 1458 | + cmdline.isset("generate-function-body")) |
| 1459 | + { |
| 1460 | + throw "Can only use one of --replace-function-body or --generate-function-body"; |
| 1461 | + } |
| 1462 | + bool only_generate = cmdline.isset("generate-function-body"); |
| 1463 | + std::regex function_regex = std::regex( |
| 1464 | + only_generate ? cmdline.get_value("generate-function-body") |
| 1465 | + : cmdline.get_value("replace-function-body")); |
| 1466 | + status() << "Replacing function bodies" << eom; |
| 1467 | + replace_function_bodies( |
| 1468 | + goto_model.goto_functions, |
| 1469 | + goto_model.symbol_table, |
| 1470 | + function_regex, |
| 1471 | + only_generate, |
| 1472 | + cmdline.get_value("replace-function-body-options"), |
| 1473 | + *this); |
| 1474 | + } |
| 1475 | + |
1451 | 1476 | // recalculate numbers, etc.
|
1452 | 1477 | goto_model.goto_functions.update();
|
1453 | 1478 | }
|
@@ -1522,9 +1547,21 @@ void goto_instrument_parse_optionst::help()
|
1522 | 1547 | " --check-invariant function instruments invariant checking function\n"
|
1523 | 1548 | " --remove-pointers converts pointer arithmetic to base+offset expressions\n" // NOLINT(*)
|
1524 | 1549 | " --splice-call caller,callee prepends a call to callee in the body of caller\n" // NOLINT(*)
|
| 1550 | + " --undefined-function-is-assume-false\n" |
1525 | 1551 | // NOLINTNEXTLINE(whitespace/line_length)
|
1526 |
| - " --undefined-function-is-assume-false\n" // NOLINTNEXTLINE(whitespace/line_length) |
1527 | 1552 | " convert each call to an undefined function to assume(false)\n"
|
| 1553 | + " --replace-function-body <regex>\n" |
| 1554 | + // NOLINTNEXTLINE(whitespace/line_length) |
| 1555 | + " Replace bodies of function matching regex\n" |
| 1556 | + " --generate-function-body <regex>\n" |
| 1557 | + // NOLINTNEXTLINE(whitespace/line_length) |
| 1558 | + " Like replace-function-body, but ignore functions that already have bodies\n" |
| 1559 | + " --replace-function-body-options <option>\n" |
| 1560 | + // NOLINTNEXTLINE(whitespace/line_length) |
| 1561 | + " One of empty, assert-false, assume-false, nondet-return\n" |
| 1562 | + " assert-false-assume-false and\n" |
| 1563 | + // NOLINTNEXTLINE(whitespace/line_length) |
| 1564 | + " havoc[,params:<regex>][,globals:<regex>]" |
1528 | 1565 | "\n"
|
1529 | 1566 | "Loop transformations:\n"
|
1530 | 1567 | " --k-induction <k> check loops with k-induction\n"
|
|
0 commit comments