本文整理汇总了C++中AstInterface::IsReturn方法的典型用法代码示例。如果您正苦于以下问题:C++ AstInterface::IsReturn方法的具体用法?C++ AstInterface::IsReturn怎么用?C++ AstInterface::IsReturn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstInterface
的用法示例。
在下文中一共展示了AstInterface::IsReturn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool PtrAnal::
ProcessTree( AstInterface &fa, const AstNodePtr& s, AstInterface::TraversalVisitType t)
{
if (t == AstInterface::PreVisit) {
AstNodePtr lhs, rhs;
AstInterface::AstNodeList vars, args;
if (fa.IsStatement(s)) {
if (DebugAliasAnal())
std::cerr << "pre visiting " << AstToString(s) << "\n";
stmt_active.push_back(stmts.size());
}
if (fa.IsReturn(s,&rhs)) {
// size_t stmt_firstIndex = stmts.size();
std::string fname = fdefined.back();
if (rhs != AST_NULL) {
std::string rhsname = Get_VarName(fa, rhs);
Stmt stmt_last = x_eq_y(func_return_name(fname), rhsname);
stmts_pushback(stmts,stmt_last);
namemap[rhs.get_ptr()] = VarRef(stmt_last, rhsname);
}
Stmt stmt_last = funcexit_x(fname);
stmts_pushback(stmts,stmt_last);
Skip(s);
}
else if (fa.IsVariableDecl( s, &vars, &args)) {
// size_t stmt_firstIndex = stmts.size();
AstInterface::AstNodeList::const_iterator pv = vars.begin();
AstInterface::AstNodeList::const_iterator pa = args.begin();
while (pv != vars.end()) {
AstNodePtr v = *pv;
AstNodePtr a = *pa;
if (a != AST_NULL) {
ProcessAssign(fa, v, a);
}
++pv;
++pa;
}
Skip(s);
}
else if ( (lhs = fa.IsExpression(s)) != AST_NULL) {
ProcessExpression(fa, "", lhs);
Skip(s);
}
}
else {
if (DebugAliasAnal())
std::cerr << "post visiting " << AstToString(s) << "\n";
if (fa.IsStatement(s)) {
size_t stmt_firstIndex = stmt_active.back();
stmt_active.pop_back();
if (stmt_firstIndex < stmts.size()) {
if (DebugAliasAnal())
std::cerr << "setting stmt mapping \n";
stmtmap[s.get_ptr()] = pair<size_t,size_t>(stmt_firstIndex, stmts.size()-1);
}
else
if (DebugAliasAnal())
std::cerr << "no translation: " << AstToString(s) << "\n";
}
}
return true;
}