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


C++ PathDiagnosticPiece::addRange方法代码示例

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


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

示例1: HandleDiagnostic

void PathDiagnosticClient::HandleDiagnostic(Diagnostic::Level DiagLevel,
                                            const DiagnosticInfo &Info) {

  // Create a PathDiagnostic with a single piece.

  PathDiagnostic* D = new PathDiagnostic();

  const char *LevelStr;
  switch (DiagLevel) {
  default:
  case Diagnostic::Ignored: assert(0 && "Invalid diagnostic type");
  case Diagnostic::Note:    LevelStr = "note: "; break;
  case Diagnostic::Warning: LevelStr = "warning: "; break;
  case Diagnostic::Error:   LevelStr = "error: "; break;
  case Diagnostic::Fatal:   LevelStr = "fatal error: "; break;
  }

  llvm::SmallString<100> StrC;
  StrC += LevelStr;
  Info.FormatDiagnostic(StrC);

  PathDiagnosticPiece *P =
    new PathDiagnosticEventPiece(Info.getLocation(), StrC.str());

  for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i)
    P->addRange(Info.getRange(i));
  for (unsigned i = 0, e = Info.getNumCodeModificationHints(); i != e; ++i)
    P->addCodeModificationHint(Info.getCodeModificationHint(i));
  D->push_front(P);

  HandlePathDiagnostic(D);
}
开发者ID:HenderOrlando,项目名称:clamav-bytecode-compiler,代码行数:32,代码来源:PathDiagnostic.cpp

示例2: PathDiagnosticEventPiece

PathDiagnosticPiece*
BugReporterVisitor::getDefaultEndPath(BugReporterContext &BRC,
                                      const ExplodedNode *EndPathNode,
                                      BugReport &BR) {
  PathDiagnosticLocation L =
    PathDiagnosticLocation::createEndOfPath(EndPathNode,BRC.getSourceManager());

  BugReport::ranges_iterator Beg, End;
  llvm::tie(Beg, End) = BR.getRanges();

  // Only add the statement itself as a range if we didn't specify any
  // special ranges for this report.
  PathDiagnosticPiece *P = new PathDiagnosticEventPiece(L,
      BR.getDescription(),
      Beg == End);
  for (; Beg != End; ++Beg)
    P->addRange(*Beg);

  return P;
}
开发者ID:Godin,项目名称:clang,代码行数:20,代码来源:BugReporterVisitors.cpp

示例3: PathDiagnosticLocation

PathDiagnosticPiece*
BugReporterVisitor::getDefaultEndPath(BugReporterContext &BRC,
                                      const ExplodedNode *EndPathNode,
                                      BugReport &BR) {
    const ProgramPoint &PP = EndPathNode->getLocation();
    PathDiagnosticLocation L;

    if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&PP)) {
        const CFGBlock *block = BE->getBlock();
        if (block->getBlockID() == 0) {
            L = PathDiagnosticLocation::createDeclEnd(PP.getLocationContext(),
                    BRC.getSourceManager());
        }
    }

    if (!L.isValid()) {
        const Stmt *S = BR.getStmt();

        if (!S)
            return NULL;

        L = PathDiagnosticLocation(S, BRC.getSourceManager(),
                                   PP.getLocationContext());
    }

    BugReport::ranges_iterator Beg, End;
    llvm::tie(Beg, End) = BR.getRanges();

    // Only add the statement itself as a range if we didn't specify any
    // special ranges for this report.
    PathDiagnosticPiece *P = new PathDiagnosticEventPiece(L,
            BR.getDescription(),
            Beg == End);
    for (; Beg != End; ++Beg)
        P->addRange(*Beg);

    return P;
}
开发者ID:,项目名称:,代码行数:38,代码来源:


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