TextDiagnosticBuffer.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===--- TextDiagnosticBuffer.cpp - Buffer Text Diagnostics ---------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file was developed by Bill Wendling and is distributed under the
  6. // University of Illinois Open Source License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This is a concrete diagnostic client, which buffers the diagnostic messages.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #include "TextDiagnosticBuffer.h"
  14. #include "clang/Basic/SourceManager.h"
  15. using namespace clang;
  16. /// HandleDiagnostic - Store the errors & warnings that are reported.
  17. ///
  18. void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level,
  19. SourceLocation Pos,
  20. diag::kind ID,
  21. const std::string *Strs,
  22. unsigned NumStrs,
  23. const SourceRange *,
  24. unsigned) {
  25. switch (Level) {
  26. default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
  27. case Diagnostic::Warning:
  28. Warnings.push_back(std::make_pair(Pos, FormatDiagnostic(Level, ID, Strs,
  29. NumStrs)));
  30. break;
  31. case Diagnostic::Error:
  32. Errors.push_back(std::make_pair(Pos, FormatDiagnostic(Level, ID, Strs,
  33. NumStrs)));
  34. break;
  35. }
  36. }