当前位置: 首页>>代码示例>>C++>>正文


C++ FactMgr::restore_facts方法代码示例

本文整理汇总了C++中FactMgr::restore_facts方法的典型用法代码示例。如果您正苦于以下问题:C++ FactMgr::restore_facts方法的具体用法?C++ FactMgr::restore_facts怎么用?C++ FactMgr::restore_facts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FactMgr的用法示例。


在下文中一共展示了FactMgr::restore_facts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ExpressionFunctionProbability

Expression *
ExpressionFuncall::make_random(CGContext &cg_context, const Type* type, const TypeQualifiers* qfer)
{
	Expression *e = 0; 
	bool std_func = ExpressionFunctionProbability(cg_context);
	
    // unary/binary "functions" produce scalar types only
	if (type && (type->eType != eSimple || type->simple_type == eVoid))
		std_func = false;

	Effect effect_accum = cg_context.get_accum_effect();
	Effect effect_stm = cg_context.get_effect_stm(); 
	FactMgr* fm = get_fact_mgr(&cg_context);
	vector<const Fact*> facts_copy = fm->global_facts; 
	FunctionInvocation *fi = FunctionInvocation::make_random(std_func, cg_context, type, qfer);
	

	if (fi->failed) { 
		// if it's a invalid invocation, (see FunctionInvocationUser::revisit) 
		// restore the env, and replace invocation with a simple var
		cg_context.reset_effect_accum(effect_accum);
		cg_context.reset_effect_stm(effect_stm);
		fm->restore_facts(facts_copy);
		e = ExpressionVariable::make_random(cg_context, type, qfer);
		delete fi;
	}
	else {
		e = new ExpressionFuncall(*fi);
	}
	return e;
}
开发者ID:jxyang,项目名称:csmith,代码行数:31,代码来源:ExpressionFuncall.cpp

示例2:

void
StatementFor::post_loop_analysis(CGContext& cg_context, vector<const Fact*>& pre_facts, Effect& pre_effect)
{
	FactMgr* fm = get_fact_mgr(&cg_context);
	assert(fm);
	// if the control reached the end of this for-loop with must-return body, it means
	// the loop is never entered. restore facts to pre-loop env
	fm->global_facts = fm->map_facts_in[&body];
	if (body.must_return()) {
		fm->restore_facts(pre_facts);
	}
	// add forward edges introduced by "break"
	for (size_t i=0; i<body.break_stms.size(); i++) {
		const StatementBreak* stm = dynamic_cast<const StatementBreak*>(body.break_stms[i]);
		fm->create_cfg_edge(stm, this, true, false);
		FactMgr::merge_jump_facts(fm->global_facts, fm->map_facts_out[stm]);
	}
	// compute accumulated effect
	set_accumulated_effect_after_block(pre_effect, &body, cg_context);
}
开发者ID:Panos90,项目名称:csmith,代码行数:20,代码来源:StatementFor.cpp


注:本文中的FactMgr::restore_facts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。