本文整理汇总了C++中namespacet::get_symbol_table方法的典型用法代码示例。如果您正苦于以下问题:C++ namespacet::get_symbol_table方法的具体用法?C++ namespacet::get_symbol_table怎么用?C++ namespacet::get_symbol_table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类namespacet
的用法示例。
在下文中一共展示了namespacet::get_symbol_table方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ansi_c_typecheck
bool ansi_c_typecheck(
exprt &expr,
message_handlert &message_handler,
const namespacet &ns)
{
symbol_tablet symbol_table;
ansi_c_parse_treet ansi_c_parse_tree;
ansi_c_typecheckt ansi_c_typecheck(
ansi_c_parse_tree, symbol_table,
ns.get_symbol_table(), "", message_handler);
try
{
ansi_c_typecheck.typecheck_expr(expr);
}
catch(int)
{
ansi_c_typecheck.error();
}
catch(const char *e)
{
ansi_c_typecheck.error() << e << messaget::eom;
}
catch(const std::string &e)
{
ansi_c_typecheck.error() << e << messaget::eom;
}
return ansi_c_typecheck.get_error_found();
}
示例2: compute_address_taken_in_symbols
void compute_address_taken_in_symbols(
std::set<irep_idt> &address_taken)
{
const symbol_tablet &symbol_table=ns.get_symbol_table();
for(const auto &s : symbol_table.symbols)
compute_address_taken_functions(s.second.value, address_taken);
}
示例3: compute_address_taken_in_symbols
void compute_address_taken_in_symbols(
std::set<irep_idt> &address_taken)
{
const symbol_tablet &symbol_table=ns.get_symbol_table();
const symbol_tablet::symbolst &s=symbol_table.symbols;
for(symbol_tablet::symbolst::const_iterator
it=s.begin(); it!=s.end(); ++it)
compute_address_taken_functions(it->second.value, address_taken);
}
示例4: assert
goto_program_coverage_recordt::goto_program_coverage_recordt(
const namespacet &ns,
goto_functionst::function_mapt::const_iterator gf_it,
const symex_coveraget::coveraget &coverage):
coverage_recordt("method")
{
assert(gf_it->second.body_available());
// identify the file name, inlined functions aren't properly
// accounted for
goto_programt::const_targett end_function=
--gf_it->second.body.instructions.end();
assert(end_function->is_end_function());
file_name=end_function->source_location.get_file();
assert(!file_name.empty());
// compute the maximum coverage of individual source-code lines
coverage_lines_mapt coverage_lines_map;
compute_coverage_lines(
gf_it->second.body,
file_name,
coverage,
coverage_lines_map);
// <method name="foo" signature="int(int)" line-rate="1.0" branch-rate="1.0">
// <lines>
// <line number="23" hits="1" branch="false"/>
// <line number="24" hits="1" branch="false"/>
// <line number="25" hits="1" branch="false"/>
// <line number="26" hits="1" branch="false"/>
// <line number="27" hits="1" branch="false"/>
// <line number="28" hits="1" branch="false"/>
// <line number="29" hits="1" branch="false"/>
// <line number="30" hits="1" branch="false"/>
// </lines>
// </method>
xml.set_attribute("name", id2string(gf_it->first));
code_typet sig_type=
original_return_type(ns.get_symbol_table(), gf_it->first);
if(sig_type.is_nil())
sig_type=gf_it->second.type;
xml.set_attribute("signature",
from_type(ns, gf_it->first, sig_type));
xml.set_attribute("line-rate",
rate_detailed(lines_covered, lines_total));
xml.set_attribute("branch-rate",
rate(branches_covered, branches_total));
xmlt &lines=xml.new_element("lines");
for(const auto &cov_line : coverage_lines_map)
{
xmlt &line=lines.new_element("line");
line.set_attribute("number", std::to_string(cov_line.first));
line.set_attribute("hits", std::to_string(cov_line.second.hits));
if(cov_line.second.conditions.empty())
line.set_attribute("branch", "false");
else
{
line.set_attribute("branch", "true");
xmlt &conditions=line.new_element("conditions");
std::size_t number=0, total_taken=0;
for(const auto &c : cov_line.second.conditions)
{
// <condition number="0" type="jump" coverage="50%"/>
xmlt &condition=conditions.new_element("condition");
condition.set_attribute("number", std::to_string(number++));
condition.set_attribute("type", "jump");
unsigned taken=c.second.false_taken+c.second.true_taken;
total_taken+=taken;
condition.set_attribute("coverage", rate(taken, 2, true));
}
line.set_attribute(
"condition-coverage",
rate_detailed(total_taken, number*2, true));
}
}
}