| 1144 | } |
| 1145 | |
| 1146 | void |
| 1147 | Reducer::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 | |
| 1183 | void |
| 1184 | Reducer::config_var_init_reduction(string cmd) |
nothing calls this directly
no test coverage detected