Ejemplo n.º 1
0
/// \brief Takes a list of diagnostics that were expected to have been generated
/// but were not and produces a diagnostic to the user from this.
static unsigned PrintExpected(DiagnosticsEngine &Diags, const llvm::SourceMgr &SourceMgr,
                              DirectiveList &DL, DiagnosticsEngine::Level Kind) {
  if (DL.empty())
    return 0;

  for (DirectiveList::iterator I = DL.begin(), E = DL.end(); I != E; ++I) {
    Directive &D = **I;

    Diags.ReportError(D.DirectiveLoc,llvm::Twine("Inconsistend verify directive: ")+D.Text);
  }

  return DL.size();
}
Ejemplo n.º 2
0
/// \brief Takes a list of diagnostics that have been generated but not matched
/// by an expected-* directive and produces a diagnostic to the user from this.
static unsigned PrintUnexpected(DiagnosticsEngine &Diags, const llvm::SourceMgr *SourceMgr,
                                const_diag_iterator diag_begin,
                                const_diag_iterator diag_end,
                                DiagnosticsEngine::Level Kind) {
  if (diag_begin == diag_end) return 0;

  for (const_diag_iterator I = diag_begin, E = diag_end; I != E; ++I) {
    switch(Kind) {
      case DiagnosticsEngine::Error: Diags.ReportError(I->first,I->second); break;
      case DiagnosticsEngine::Warning: Diags.ReportWarning(I->first,I->second); break;
      case DiagnosticsEngine::Note: Diags.ReportNote(I->first,I->second); break;
      default: break;
    }
  }
  return std::distance(diag_begin, diag_end);
}