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


C++ CFGNode::getIndex方法代码示例

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


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

示例1: defaultFilter

  // the default interesting filter
  bool defaultFilter (CFGNode cfgn)
  {
    SgNode * node = cfgn.getNode();
    assert (node != NULL) ;
    //Keep the last index for initialized names. This way the definition of the variable doesn't
    //propagate to its assign initializer.
    // if (isSgInitializedName(node))
    // { 
    //   return (cfgn == node->cfgForEnd());
    // }
    // else
    //   return (cfgn.isInteresting());
    switch(node->variantT()) {         
      //Keep the last index for initialized names. This way the definition of the variable doesn't
      //propagate to its assign initializer.
      case V_SgInitializedName:
          return (cfgn == node->cfgForEnd());

      // filter out this node type
      // abstract memory object cannot be created for these nodes
      case V_SgExprListExp:
      case V_SgNullStatement:
      case V_SgExprStatement:
      case V_SgFunctionRefExp:
          return false;

      case V_SgFunctionCallExp:
          return cfgn.getIndex()==2 || cfgn.getIndex()==3;

      case V_SgFunctionParameterList:
          return true;
          //return cfgn.getIndex()==1;*/
          
      case V_SgFunctionDefinition:
          return cfgn.getIndex()==3;
      
      case V_SgReturnStmt:
          return cfgn.getIndex()==1;
          
      // Filter out intermediate dot expressions. We only care about the complete ones.
      case V_SgDotExp:
        //cout << "defaultFilter() node="<<cfgUtils::SgNode2Str(node)<<" node->get_parent()="<<cfgUtils::SgNode2Str(node->get_parent())<<" interesting="<<(!isSgDotExp(node->get_parent()))<<endl;
        return !isSgDotExp(node->get_parent());
      /*case V_SgCastExp:
          return false;*/
      
      default:
          return cfgn.isInteresting();
    }
  }
开发者ID:8l,项目名称:rose,代码行数:51,代码来源:DataflowCFG.C

示例2: isDataflowInteresting

 bool isDataflowInteresting(CFGNode cn) {
         ROSE_ASSERT (cn.getNode());
         return (cn.getNode()->cfgIsIndexInteresting(cn.getIndex()) && 
                //!isSgFunctionRefExp(cn.getNode()) &&
                !isSgExprListExp(cn.getNode()) &&
                !isSgForInitStatement(cn.getNode()) &&
                //!isSgVarRefExp(cn.getNode()) &&
                //!isSgValueExp(cn.getNode()) &&
                //!isSgExprStatement(cn.getNode()) &&
                !(isSgInitializedName(cn.getNode()) && cn.getIndex()==0)) 
                ||
                (isSgIfStmt(cn.getNode()) &&
                 cn.getIndex()==1 || cn.getIndex()==2);
 }
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:14,代码来源:DataflowCFG.C

示例3: buildCFG

void CFG::buildCFG(CFGNode n)
{
    ROSE_ASSERT(n.getNode());

    if (explored_.count(n) > 0)
        return;
    explored_.insert(n);

    SgGraphNode* from = NULL;
    if (all_nodes_.count(n) > 0)
    {
        from = all_nodes_[n];
    }
    else
    {
        from = new SgGraphNode;
        from->set_SgNode(n.getNode());
        from->addNewAttribute("info", new CFGNodeAttribute(n.getIndex(), graph_));
        all_nodes_[n] = from;
        graph_->addNode(from);
    }

    std::vector<VirtualCFG::CFGEdge> outEdges = n.outEdges();
    foreach (const VirtualCFG::CFGEdge& edge, outEdges)
    {
        CFGNode tar = edge.target();

        SgGraphNode* to = NULL;
        if (all_nodes_.count(tar) > 0)
            to = all_nodes_[tar];
        else
        {
            to = new SgGraphNode;
            to->set_SgNode(tar.getNode());
            to->addNewAttribute("info", new CFGNodeAttribute(tar.getIndex(), graph_));
            all_nodes_[tar] = to;
            graph_->addNode(to);
        }

        graph_->addDirectedEdge(new SgDirectedGraphEdge(from, to));
    }
开发者ID:matzke1,项目名称:rose-develop,代码行数:41,代码来源:staticCFG.C


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