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


C++ AstInterface::IsExpression方法代码示例

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


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

示例1: may_alias

bool PtrAnal::
may_alias(AstInterface& fa, const AstNodePtr& _r1, const AstNodePtr& _r2)
{
  AstNodePtr r1 = fa.IsExpression(_r1);
  AstNodePtr r2 = fa.IsExpression(_r2);
  if (r1 == AST_NULL || r2 == AST_NULL)
    assert(false);
  std::string varname1 = Get_VarName(fa, r1), varname2 = Get_VarName(fa, r2);
  return may_alias(varname1, varname2);
}
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:10,代码来源:PtrAnal.C

示例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;
 }
开发者ID:faizurahman,项目名称:rose,代码行数:20,代码来源:PtrAnalTest.C

示例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;
}
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:63,代码来源:PtrAnal.C


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