/// \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);
}