本文整理汇总了C++中AstInterface::IsStatement方法的典型用法代码示例。如果您正苦于以下问题:C++ AstInterface::IsStatement方法的具体用法?C++ AstInterface::IsStatement怎么用?C++ AstInterface::IsStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AstInterface
的用法示例。
在下文中一共展示了AstInterface::IsStatement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
bool operator()( AstInterface& fa, const AstNodePtr& head, AstNodePtr& result)
{
#ifdef DEBUG
std::cerr << "LoopTransformationWrap:operator()\n";
#endif
if (!fa.IsStatement(head))
return false;
fa.SetRoot( head);
return LoopTransformation(head, result);
}
示例2: Traverse
virtual bool Traverse( AstInterface &fa, const AstNodePtr& _n,
AstInterface::TraversalVisitType t)
{
AstNodePtr n = fa.IsExpression(_n);
if (n != AST_NULL) {
PtrAnal::VarRef p = m.translate_exp(n);
if (p.name != "") {
std::cout << AstInterface::AstToString(n) << ":" <<
((long) p.stmt) << p.name << "\n";
}
}
else if (fa.IsStatement(_n)) {
PtrAnal::StmtRef p = m.translate_stmt(_n);
if (p.size()) {
std::cout << AstInterface::AstToString(_n) << ":" <<
((long) p.front()) << "->" << ((long)p.back()) << "\n";
}
}
return true;
}
示例3: 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;
}