예제 #1
0
파일: Diagnostic.cpp 프로젝트: degano/clang
void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) {
    assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!");

    CurDiagLoc = storedDiag.getLocation();
    CurDiagID = storedDiag.getID();
    NumDiagArgs = 0;

    DiagRanges.clear();
    DiagRanges.reserve(storedDiag.range_size());
    for (StoredDiagnostic::range_iterator
            RI = storedDiag.range_begin(),
            RE = storedDiag.range_end(); RI != RE; ++RI)
        DiagRanges.push_back(*RI);

    DiagFixItHints.clear();
    DiagFixItHints.reserve(storedDiag.fixit_size());
    for (StoredDiagnostic::fixit_iterator
            FI = storedDiag.fixit_begin(),
            FE = storedDiag.fixit_end(); FI != FE; ++FI)
        DiagFixItHints.push_back(*FI);

    assert(Client && "DiagnosticConsumer not set!");
    Level DiagLevel = storedDiag.getLevel();
    Diagnostic Info(this, storedDiag.getMessage());
    Client->HandleDiagnostic(DiagLevel, Info);
    if (Client->IncludeInDiagnosticCounts()) {
        if (DiagLevel == DiagnosticsEngine::Warning)
            ++NumWarnings;
    }

    CurDiagID = ~0U;
}
예제 #2
0
void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) {
  assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!");

  CurDiagLoc = storedDiag.getLocation();
  CurDiagID = storedDiag.getID();
  NumDiagArgs = 0;

  NumDiagRanges = storedDiag.range_size();
  assert(NumDiagRanges < DiagnosticsEngine::MaxRanges &&
         "Too many arguments to diagnostic!");
  unsigned i = 0;
  for (StoredDiagnostic::range_iterator
         RI = storedDiag.range_begin(),
         RE = storedDiag.range_end(); RI != RE; ++RI)
    DiagRanges[i++] = *RI;

  assert(NumDiagRanges < DiagnosticsEngine::MaxFixItHints &&
         "Too many arguments to diagnostic!");
  NumDiagFixItHints = 0;
  for (StoredDiagnostic::fixit_iterator
         FI = storedDiag.fixit_begin(),
         FE = storedDiag.fixit_end(); FI != FE; ++FI)
    DiagFixItHints[NumDiagFixItHints++] = *FI;

  assert(Client && "DiagnosticConsumer not set!");
  Level DiagLevel = storedDiag.getLevel();
  Diagnostic Info(this, storedDiag.getMessage());
  Client->HandleDiagnostic(DiagLevel, Info);
  if (Client->IncludeInDiagnosticCounts()) {
    if (DiagLevel == DiagnosticsEngine::Warning)
      ++NumWarnings;
  }

  CurDiagID = ~0U;
}