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

Method mark_func_end

src/FactPointTo.cpp:140–168  ·  view source on GitHub ↗

mark any local variable in point_to_vars as dead, note this create a new fact, and if no local variable is in point-to set, return null to indicate no update is neccessary */

Source from the content-addressed store, hash-verified

138 point-to set, return null to indicate no update is neccessary
139 */
140FactPointTo*
141FactPointTo::mark_func_end(const Statement* stm)
142{
143 vector<const Variable*> var_set = point_to_vars;
144 size_t len = var_set.size();
145 bool changed = false;
146 bool has_garbage_ptr = (find_variable_in_set(var_set, garbage_ptr) >= 0);
147 const Function* func = stm->func;
148
149 for (size_t i=0; i<len; i++) {
150 const Variable* v = var_set[i];
151 if (func->is_var_on_stack(v, stm)) {
152 if (has_garbage_ptr) {
153 var_set.erase(var_set.begin() + i);
154 i--;
155 len--;
156 }
157 else {
158 var_set[i] = garbage_ptr;
159 has_garbage_ptr = true;
160 }
161 changed = true;
162 }
163 }
164 if (changed) {
165 return FactPointTo::make_fact(var, var_set);
166 }
167 return 0;
168}
169
170int
171FactPointTo::size() const

Callers 1

Calls 4

find_variable_in_setFunction · 0.85
sizeMethod · 0.80
beginMethod · 0.80
is_var_on_stackMethod · 0.45

Tested by

no test coverage detected