* remove facts concerning variables local to a function * hint: relevant facts are those concerns variable visible at the end of this function */
| 183 | * hint: relevant facts are those concerns variable visible at the end of this function |
| 184 | */ |
| 185 | void |
| 186 | FactMgr::remove_function_local_facts(std::vector<const Fact*>& inputs, const Statement* stm) |
| 187 | { |
| 188 | size_t i; |
| 189 | size_t len = inputs.size(); |
| 190 | assert(stm->func); |
| 191 | const Function* func = stm->func; |
| 192 | // remove irrelevant facts |
| 193 | for (i=0; i<len; i++) { |
| 194 | const Variable* v = inputs[i]->get_var(); |
| 195 | // if it's fact for a local variable of this function, or return variable |
| 196 | // of another function, we are not interested in them after exit function |
| 197 | if (func->is_var_on_stack(v, stm) || (v->is_rv() && !func->rv->match(v))) { |
| 198 | inputs.erase(inputs.begin() + i); |
| 199 | i--; |
| 200 | len--; |
| 201 | } |
| 202 | } |
| 203 | // mark any remaining facts that may point to a local vars of this |
| 204 | // function as "point to garbage" |
| 205 | for (i=0; i<inputs.size(); i++) { |
| 206 | if (inputs[i]->eCat == ePointTo) { |
| 207 | FactPointTo* f = (FactPointTo*)(inputs[i]); |
| 208 | FactPointTo* new_fact = f->mark_func_end(stm); |
| 209 | if (new_fact) { |
| 210 | inputs[i] = new_fact; |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | void |
| 217 | FactMgr::setup_in_out_maps(bool first_time) |
nothing calls this directly
no test coverage detected