本文整理汇总了C++中symbol_tablet::lookup方法的典型用法代码示例。如果您正苦于以下问题:C++ symbol_tablet::lookup方法的具体用法?C++ symbol_tablet::lookup怎么用?C++ symbol_tablet::lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类symbol_tablet
的用法示例。
在下文中一共展示了symbol_tablet::lookup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_function
/// Remove the body of function "identifier" such that an analysis will treat it
/// as a side-effect free function with non-deterministic return value.
/// \par parameters: symbol_table Input symbol table to be modified
/// goto_functions Input functions to be modified
/// identifier Function to be removed
/// message_handler Error/status output
void remove_function(
symbol_tablet &symbol_table,
goto_functionst &goto_functions,
const irep_idt &identifier,
message_handlert &message_handler)
{
messaget message(message_handler);
goto_functionst::function_mapt::iterator entry=
goto_functions.function_map.find(identifier);
if(entry==goto_functions.function_map.end())
{
message.error() << "No function " << identifier
<< " in goto program" << messaget::eom;
return;
}
else if(entry->second.is_inlined())
{
message.warning() << "Function " << identifier << " is inlined, "
<< "instantiations will not be removed"
<< messaget::eom;
}
if(entry->second.body_available())
{
message.status() << "Removing body of " << identifier
<< messaget::eom;
entry->second.clear();
symbol_table.lookup(identifier).value.make_nil();
}
}
示例2: get_prog_var_name
std::string get_prog_var_name(const symbol_tablet &st,
const goto_programt::targett &decl)
{
const irep_idt &base_id=st.lookup(get_affected_variable(*decl)).base_name;
std::string base_name(id2string(base_id));
return base_name+=PROG_SUFFIX;
}
示例3: assign_jsa_meta_variable
goto_programt::targett assign_jsa_meta_variable(const symbol_tablet &st,
goto_functionst &gf, const goto_programt::targett &pos,
const std::string &base_name, const exprt &expr_value)
{
const std::string name(get_cegis_meta_name(base_name));
const symbol_exprt lhs(st.lookup(name).symbol_expr());
return jsa_assign(st, gf, pos, lhs, expr_value);
}
示例4: cegis_operand
dereference_exprt cegis_operand(const symbol_tablet &st,
const std::string &func_name, const typet &type, const size_t op)
{
const member_exprt operand_id(cegis_operand_id(st, func_name, op));
const std::string array_name(cegis_operand_array_name(st, type));
const symbol_exprt array(st.lookup(array_name).symbol_expr());
return dereference_exprt(index_exprt(array, operand_id), type);
}
示例5: execute_inv_prog
void execute_inv_prog(const symbol_tablet &st, goto_functionst &gf,
const size_t max_solution_size, const goto_programt::targett &decl,
const std::string &prog_base_name)
{
goto_programt &body=get_entry_body(gf);
goto_programt::targett pos=decl;
goto_programt::targett execution=body.insert_after(++pos);
execution->type=goto_program_instruction_typet::FUNCTION_CALL;
execution->source_location=default_cegis_source_location();
code_function_callt call;
call.function()=st.lookup(DANGER_EXECUTE).symbol_expr();
const std::string prog_name(get_cegis_meta_name(prog_base_name));
const symbol_exprt prog_symbol(st.lookup(prog_name).symbol_expr());
const typet size_type(unsigned_int_type());
const constant_exprt index(from_integer(0u, size_type));
const index_exprt first_elem(prog_symbol, index);
call.arguments().push_back(address_of_exprt(first_elem));
const constant_exprt size(from_integer(max_solution_size, size_type));
call.arguments().push_back(size);
execution->code=call;
}
示例6: propagate_controller_sizes
void propagate_controller_sizes(const symbol_tablet &st, goto_functionst &gf)
{
const symbolt &symbol=st.lookup(CEGIS_CONTROL_SOLUTION_VAR_NAME);
const struct_exprt &controller_value=to_struct_expr(symbol.value);
const namespacet ns(st);
const exprt &a_size=get_a_size(ns, controller_value);
const exprt &b_size=get_b_size(ns, controller_value);
replace_sizes_visitort visitor(a_size, b_size);
goto_programt &body=get_entry_body(gf);
for (goto_programt::instructiont &instr : body.instructions)
{
instr.code.visit(visitor);
instr.guard.visit(visitor);
}
}
示例7: java_static_lifetime_init
bool java_static_lifetime_init(
symbol_tablet &symbol_table,
const source_locationt &source_location,
message_handlert &message_handler)
{
symbolt &initialize_symbol=symbol_table.lookup(INITIALIZE);
code_blockt &code_block=to_code_block(to_code(initialize_symbol.value));
// we need to zero out all static variables
for(symbol_tablet::symbolst::const_iterator
it=symbol_table.symbols.begin();
it!=symbol_table.symbols.end();
it++)
{
if(it->second.type.id()!=ID_code &&
it->second.is_lvalue &&
it->second.is_state_var &&
it->second.is_static_lifetime &&
it->second.value.is_not_nil() &&
it->second.mode==ID_java)
{
code_assignt assignment(it->second.symbol_expr(), it->second.value);
code_block.add(assignment);
}
}
// we now need to run all the <clinit> methods
for(symbol_tablet::symbolst::const_iterator
it=symbol_table.symbols.begin();
it!=symbol_table.symbols.end();
it++)
{
if(it->second.base_name=="<clinit>" &&
it->second.type.id()==ID_code &&
it->second.mode==ID_java)
{
code_function_callt function_call;
function_call.lhs()=nil_exprt();
function_call.function()=it->second.symbol_expr();
code_block.add(function_call);
}
}
return false;
}
示例8: get_size
size_t get_size(const symbol_tablet &st, const char * const id)
{
return to_size(to_array_type(st.lookup(id).type).size());
}