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

Method filter

src/Statement.cpp:139–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139bool StatementFilter::filter(int value) const
140{
141 assert(value != -1);
142
143 if (!this->valid_filter())
144 return false;
145
146 eStatementType type = Statement::number_to_type(value);
147
148 // If expand_check returns false, we filter out v.
149 if (!PartialExpander::expand_check(type))
150 return true;
151
152 const Type* return_type = cg_context_.get_current_func()->return_type;
153 bool no_return = (return_type->eType == eSimple && return_type->simple_type == eVoid);
154
155 if (type == eBlock) {
156 return true;
157 }
158 if ((type == eReturn) && no_return) {
159 return true;
160 }
161
162 if ( (type == eBreak || type == eContinue) && !(cg_context_.flags & IN_LOOP) ) {
163 return true;
164 }
165
166 // Limit Function complexity (depth of nested control structures)
167 if (cg_context_.blk_depth >= CGOptions::max_blk_depth()) {
168 return Statement::is_compound(type);
169 }
170 else if (Function::reach_max_functions_cnt()) { // Limit # of functions..
171 if (type != eInvoke)
172 return false;
173 else
174 return true;
175 }
176 else {
177 return false;
178 }
179
180 return false;
181}
182
183int find_stm_in_set(const vector<const Statement*>& set, const Statement* s)
184{

Callers

nothing calls this directly

Calls 2

valid_filterMethod · 0.80
get_current_funcMethod · 0.80

Tested by

no test coverage detected