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

Method output_block_skeleton

src/Reducer.cpp:313–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void
314Reducer::output_block_skeleton(const Block* blk, vector<const Block*>& work_blks, vector<const Function*>& work_funcs, std::ostream& out)
315{
316 size_t i, j;
317 vector<const Block*> blks;
318 vector<const FunctionInvocationUser*> funcalls;
319 vector<const Function*> uniq_funcs;
320 out << "****** block: " << blk->stm_id << " ******" << endl;
321 for (i=0; i<blk->stms.size(); i++) {
322 const Statement* stm = blk->stms[i];
323 funcalls.clear();
324 uniq_funcs.clear();
325 stm->get_called_funcs(funcalls);
326 stm->get_blocks(blks);
327 out << stm->stm_id;
328 if (funcalls.size() > 0) {
329 // find the unique functions that was called
330 for (j=0; j<funcalls.size(); j++) {
331 const Function* f = funcalls[j]->get_func();
332 if (find_function_in_set(uniq_funcs, f) == -1) {
333 uniq_funcs.push_back(f);
334 }
335 }
336 // print the unique functions, add them to work list if necessary
337 out << "(";
338 for (j=0; j<uniq_funcs.size(); j++) {
339 if (j > 0) {
340 out << ", ";
341 }
342 const Function* f = uniq_funcs[j];
343 if (find_function_in_set(work_funcs, f) == -1) {
344 work_funcs.push_back(f);
345 }
346 out << f->name;
347 }
348 out << ")";
349 }
350 if (blks.size() > 0) {
351 out << "{";
352 for (j=0; j<blks.size(); j++) {
353 if (j > 0) {
354 out << ", ";
355 }
356 work_blks.push_back(blks[j]);
357 out << blks[j]->stm_id;
358 }
359 out << "}";
360 }
361 out << endl;
362 }
363}
364
365bool
366Reducer::is_blk_deleted(const Block* b) const

Callers

nothing calls this directly

Calls 6

find_function_in_setFunction · 0.85
sizeMethod · 0.80
get_funcMethod · 0.80
clearMethod · 0.45
get_called_funcsMethod · 0.45
get_blocksMethod · 0.45

Tested by

no test coverage detected