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

Method config_if_reduction

src/Reducer.cpp:1146–1181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1144}
1145
1146void
1147Reducer::config_if_reduction(string cmd)
1148{
1149 if (cmd.find(",") == string::npos) {
1150 // the reducer treats func_1 as main
1151 output_if_ids = (cmd == "poll");
1152 }
1153 else {
1154 size_t i;
1155 vector<string> strs;
1156 StringUtils::split_string(cmd, strs, ",");
1157 for (i=0; i<strs.size(); i++) {
1158 string s = strs[i];
1159 bool rollback = false;
1160 if (!s.empty() && s[s.length()-1] == '+') {
1161 s = s.substr(0, s.length() -1);
1162 rollback = true;
1163 }
1164 const Statement* stm = find_stm_by_id(StringUtils::str2int(s));
1165 assert(stm && stm->eType == eIfElse);
1166 const StatementIf* si = (const StatementIf*)stm;
1167 if (is_blk_deleted(si->get_false_branch())) {
1168 replace_stm(si, si->get_true_branch(), "");
1169 }
1170 else if (is_blk_deleted(si->get_true_branch())) {
1171 replace_stm(si, si->get_false_branch(), "");
1172 }
1173 // at least one branch should be deleted
1174 else assert(0);
1175
1176 if (rollback) {
1177 must_use_var_stms.push_back(stm);
1178 }
1179 }
1180 }
1181}
1182
1183void
1184Reducer::config_var_init_reduction(string cmd)

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.80
get_false_branchMethod · 0.80
get_true_branchMethod · 0.80

Tested by

no test coverage detected