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


C++ PEdge::AsLoop方法代码示例

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


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

示例1: PrintUI

void WherePostcondition::PrintUI(OutStream &out) const
{
  PEdge *edge = m_frame->CFG()->GetSingleOutgoingEdge(m_point);
  Location *loc = m_frame->CFG()->GetPointLocation(m_point);

  if (edge->IsLoop()) {
    const char *loop_name = edge->AsLoop()->GetLoopId()->LoopName();
    out << "LoopInvariant [" << loop_name << "]";
  }
  else {
    out << "Postcondition [";

    PEdgeCall *nedge = edge->AsCall();
    Exp *function = nedge->GetFunction();
    function->PrintUI(out, true);

    out << ":" << loc->Line() << "]";
  }

  if (m_bit) {
    Bit *new_bit = BitConvertExitClobber(m_bit);

    out << " :: ";
    new_bit->PrintUI(out, true);
    new_bit->DecRef();
  }
}
开发者ID:wh5a,项目名称:xgill,代码行数:27,代码来源:where.cpp

示例2: PrintHook

void WherePostcondition::PrintHook(OutStream &out) const
{
  BlockId *id = m_frame->CFG()->GetId();
  Variable *func_var = id->BaseVar();

  PEdge *edge = m_frame->CFG()->GetSingleOutgoingEdge(m_point);

  if (edge->IsLoop()) {
    PEdgeLoop *nedge = edge->AsLoop();
    out << nedge->GetLoopId()->Loop()->Value() << " "
        << func_var->GetName()->Value();
  }
  else {
    PEdgeCall *nedge = edge->AsCall();

    if (Variable *callee = nedge->GetDirectFunction()) {
      // direct call, just one hook function.
      out << "post " << callee->GetName()->Value();
    }
    else {
      // indirect call, one hook function for each callee.
      CallEdgeSet *callees = CalleeCache.Lookup(func_var);
      bool found_callee = false;

      if (callees) {
        for (size_t eind = 0; eind < callees->GetEdgeCount(); eind++) {
          const CallEdge &edge = callees->GetEdge(eind);
          if (edge.where.id == id && edge.where.point == m_point) {
            if (found_callee)
              out << "$";  // add the separator
            found_callee = true;

            out << "post " << edge.callee->GetName()->Value();
          }
        }
      }

      CalleeCache.Release(func_var);
    }
  }
}
开发者ID:brifordwylie,项目名称:turnersr.github.io,代码行数:41,代码来源:where.cpp


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