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

Method make_random

src/StatementBreak.cpp:59–82  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

57 *
58 */
59StatementBreak *
60StatementBreak::make_random(CGContext &cg_context)
61{
62 // quick fix: don't generate break statement for nested loops (this including multi-dimension array operations)
63 // JYTODO: treat "break" for nested loops as "continue", because it's effect is going back to the
64 // head of loop body, same as continue
65 //if (cg_context.focus_var && cg_context.focus_var->get_dimension() > 1) {
66 // return 0;
67 //}
68 //FactMgr* fm = get_fact_mgr(&cg_context);
69 // find the closest looping parent block: the one "continue"
70 // would apply to
71 Block* b = cg_context.get_current_block();
72 while (b && !b->looping) {
73 b = b->parent;
74 }
75 assert(b);
76 cg_context.get_effect_stm().clear();
77 Expression *expr = Expression::make_random(cg_context, get_int_type(), 0, true, true, eVariable);
78 ERROR_GUARD(NULL);
79 StatementBreak* sc = new StatementBreak(cg_context.get_current_block(), *expr, *b);
80 b->break_stms.push_back(sc);
81 return sc;
82}
83
84/*
85 *

Callers

nothing calls this directly

Calls 3

get_int_typeFunction · 0.85
get_current_blockMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected