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


C++ DSNode::getNodeFlags方法代码示例

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


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

示例1: verify

/// verify - This is the function which checks to make sure that all of the
/// invariants established on the command line are true.
///
void DSGC::verify(const DSGraph* G) {
  // Loop over all of the nodes, checking to see if any are collapsed...
  if (AbortIfAnyCollapsed) {
    for (DSGraph::node_const_iterator I = G->node_begin(), E = G->node_end();
         I != E; ++I)
      if (I->isNodeCompletelyFolded()) {
        cerr << "Node is collapsed: ";
        I->print(cerr, G);
        abort();
      }
  }

  if (!AbortIfCollapsed.empty() || !CheckFlags.empty() ||
      !AbortIfMerged.empty()) {
    // Convert from a list to a set, because we don't have cl::set's yet.  FIXME
    std::set<std::string> AbortIfCollapsedS(AbortIfCollapsed.begin(),
                                            AbortIfCollapsed.end());
    std::set<std::string> AbortIfMergedS(AbortIfMerged.begin(),
                                         AbortIfMerged.end());
    std::map<std::string, unsigned> CheckFlagsM;

    for (cl::list<std::string>::iterator I = CheckFlags.begin(),
           E = CheckFlags.end(); I != E; ++I) {
      std::string::size_type ColonPos = I->rfind(':');
      if (ColonPos == std::string::npos) {
        cerr << "Error: '" << *I
             << "' is an invalid value for the --dsgc-check-flags option!\n";
        abort();
      }

      unsigned Flags = 0;
      for (unsigned C = ColonPos+1; C != I->size(); ++C)
        switch ((*I)[C]) {
        case 'S': Flags |= DSFlags::AllocaNode;      break;
        case 'H': Flags |= DSFlags::HeapNode;        break;
        case 'G': Flags |= DSFlags::GlobalNode;      break;
        case 'U': Flags |= DSFlags::UnknownNode;     break;
        case 'I': Flags |= DSFlags::IncompleteNode;  break;
        case 'M': Flags |= DSFlags::ModifiedNode;    break;
        case 'R': Flags |= DSFlags::ReadNode;        break;
        case 'A': Flags |= DSFlags::ArrayNode;       break;
        default: cerr << "Invalid DSNode flag!\n"; abort();
        }
      CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags;
    }

    // Now we loop over all of the scalars, checking to see if any are collapsed
    // that are not supposed to be, or if any are merged together.
    const DSGraph::ScalarMapTy &SM = G->getScalarMap();
    std::map<DSNode*, std::string> AbortIfMergedNodes;

    for (DSGraph::ScalarMapTy::const_iterator I = SM.begin(), E = SM.end();
         I != E; ++I)
      if (I->first->hasName() && I->second.getNode()) {
        const std::string &Name = I->first->getName();
        DSNode *N = I->second.getNode();

        // Verify it is not collapsed if it is not supposed to be...
        if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) {
          cerr << "Node for value '%" << Name << "' is collapsed: ";
          N->print(cerr, G);
          abort();
        }

        if (CheckFlagsM.count(Name) && CheckFlagsM[Name] != N->getNodeFlags()) {
          cerr << "Node flags are not as expected for node: " << Name 
               << " (" << CheckFlagsM[Name] << ":" <<N->getNodeFlags()
               << ")\n";
          N->print(cerr, G);
          abort();
        }

        // Verify that it is not merged if it is not supposed to be...
        if (AbortIfMergedS.count(Name)) {
          if (AbortIfMergedNodes.count(N)) {
            cerr << "Nodes for values '%" << Name << "' and '%"
                 << AbortIfMergedNodes[N] << "' is merged: ";
            N->print(cerr, G);
            abort();
          }
          AbortIfMergedNodes[N] = Name;
        }
      }
  }
}
开发者ID:C0deZLee,项目名称:IntFlow,代码行数:88,代码来源:GraphChecker.cpp


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