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

Method create_and_initialize

src/VariableSelector.cpp:500–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500Variable *
501VariableSelector::create_and_initialize(Effect::Access access, const CGContext &cg_context, const Type* t,
502 const CVQualifiers* qfer, Block *blk, std::string name)
503{
504 const Expression* init = NULL;
505 Variable* var = NULL;
506
507 if (rnd_flipcoin(NewArrayVariableProb)) {
508 if (CGOptions::strict_const_arrays()) {
509 init = Constant::make_random(t);
510 } else {
511 init = make_init_value(access, cg_context, t, qfer, blk);
512 }
513 var = create_array_and_itemize(blk, name, cg_context, t, init, qfer);
514 }
515 else {
516 init = make_init_value(access, cg_context, t, qfer, blk);
517 var = new_variable(name, t, init, qfer);
518 }
519 assert(var);
520 return var;
521}
522
523static int tmp_count = 0;
524// --------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

rnd_flipcoinFunction · 0.85

Tested by

no test coverage detected