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

Method remove_function_local_facts

src/FactMgr.cpp:185–214  ·  view source on GitHub ↗

* remove facts concerning variables local to a function * hint: relevant facts are those concerns variable visible at the end of this function */

Source from the content-addressed store, hash-verified

183 * hint: relevant facts are those concerns variable visible at the end of this function
184 */
185void
186FactMgr::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
216void
217FactMgr::setup_in_out_maps(bool first_time)

Callers

nothing calls this directly

Calls 7

sizeMethod · 0.80
is_rvMethod · 0.80
beginMethod · 0.80
mark_func_endMethod · 0.80
get_varMethod · 0.45
is_var_on_stackMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected