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

Method GenerateNewNonArrayGlobal

src/VariableSelector.cpp:558–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

556}
557
558Variable *
559VariableSelector::GenerateNewNonArrayGlobal(Effect::Access access, const CGContext &cg_context, const Type* t, const CVQualifiers* qfer)
560{
561 ERROR_GUARD(NULL);
562 CVQualifiers var_qfer = (!qfer || qfer->wildcard)
563 ? CVQualifiers::random_qualifiers(t, access, cg_context, false)
564 : *qfer;
565 ERROR_GUARD(NULL);
566 string name = RandomGlobalName();
567 tmp_count++;
568
569 const Expression *init = make_init_value(access, cg_context, t, qfer, NULL);
570 ERROR_GUARD(NULL);
571 Variable *var = new_variable(name, t, init, qfer);
572
573 GlobalList.push_back(var);
574 // for DFA
575 FactMgr* fm = get_fact_mgr(&cg_context);
576 fm->add_new_var_fact_and_update_inout_maps(NULL, var->get_collective());
577 cg_context.get_current_func()->new_globals.push_back(var);
578
579 if (!var_qfer.is_volatile()) {
580 GlobalNonvolatilesList.push_back(var);
581 }
582 var_created = true;
583 return var;
584}
585
586Variable*
587VariableSelector::eager_create_global_struct(Effect::Access access, const CGContext &cg_context,

Callers

nothing calls this directly

Calls 6

RandomGlobalNameFunction · 0.85
get_fact_mgrFunction · 0.85
get_current_funcMethod · 0.80
get_collectiveMethod · 0.45
is_volatileMethod · 0.45

Tested by

no test coverage detected