MCPcopy Create free account
hub / github.com/csmith-project/csmith / configure_diff_active_blks

Method configure_diff_active_blks

src/Reducer.cpp:932–969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930}
931
932int
933Reducer::configure_diff_active_blks(string line, int first_bid)
934{
935 vector<int> ids;
936 StringUtils::split_int_string(line, ids, ",()");
937 size_t i;
938 assert(!ids.empty());
939 const Block* one_branch = find_block_by_id(first_bid);
940 assert(one_branch);
941 const Statement* stm = one_branch->find_container_stm();
942 if (stm && stm->eType == eIfElse) {
943 for (i=0; i<ids.size(); i+=2) {
944 int id = ids[i];
945 if (1) { //id <= first_bid) {
946 int cnt = ids[i+1];
947 const Block* blk = find_block_by_id(id);
948 assert(blk);
949 map_active_blks[blk] = cnt;
950 }
951 }
952 const StatementIf* si = (const StatementIf*)stm;
953 const Block* other_branch = (one_branch == si->get_false_branch()) ? si->get_true_branch() : si->get_false_branch();
954 map_active_blks[other_branch] = map_active_blks[one_branch];
955 assert(!used_vars.empty());
956
957 // replace both branches with direct conflicting assignments
958 string vname = monitored_var->name;
959 string assign1 = vname + " = 0;";
960 string assign2 = vname + " = 1;";
961 replace_stm(one_branch, NULL, assign1);
962 replace_stm(other_branch, NULL, assign2);
963
964 // delete all statement following this if-else statement
965 delete_stms_after(si, true);
966 return 1;
967 }
968 else return 0;
969}
970
971void
972Reducer::config_active_blks(string cmd)

Callers

nothing calls this directly

Calls 5

find_block_by_idFunction · 0.85
find_container_stmMethod · 0.80
sizeMethod · 0.80
get_false_branchMethod · 0.80
get_true_branchMethod · 0.80

Tested by

no test coverage detected