| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | //===--- TextDiagnosticBuffer.h - Buffer Text Diagnostics -------*- C++ -*-===// | 
 | 2 | // | 
 | 3 | //                     The LLVM Compiler Infrastructure | 
 | 4 | // | 
| Chris Lattner | 0bc735f | 2007-12-29 19:59:25 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source | 
 | 6 | // License. See LICENSE.TXT for details. | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 7 | // | 
 | 8 | //===----------------------------------------------------------------------===// | 
 | 9 | // | 
 | 10 | // This is a concrete diagnostic client, which buffers the diagnostic messages. | 
 | 11 | // | 
 | 12 | //===----------------------------------------------------------------------===// | 
 | 13 |  | 
 | 14 | #ifndef DRIVER_TEXT_DIAGNOSTIC_BUFFER_H_ | 
 | 15 | #define DRIVER_TEXT_DIAGNOSTIC_BUFFER_H_ | 
 | 16 |  | 
 | 17 | #include "TextDiagnostics.h" | 
 | 18 | #include <vector> | 
 | 19 |  | 
 | 20 | namespace clang { | 
 | 21 |  | 
 | 22 | class Preprocessor; | 
 | 23 | class SourceManager; | 
 | 24 |  | 
 | 25 | class TextDiagnosticBuffer : public TextDiagnostics { | 
 | 26 | public: | 
 | 27 |   typedef std::vector<std::pair<SourceLocation, std::string> > DiagList; | 
 | 28 |   typedef DiagList::iterator iterator; | 
 | 29 |   typedef DiagList::const_iterator const_iterator; | 
 | 30 | private: | 
 | 31 |   DiagList Errors, Warnings; | 
 | 32 | public: | 
| Ted Kremenek | 7a9d49f | 2007-12-11 21:27:55 +0000 | [diff] [blame] | 33 |   TextDiagnosticBuffer() {} | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 34 |  | 
 | 35 |   const_iterator err_begin() const  { return Errors.begin(); } | 
 | 36 |   const_iterator err_end() const    { return Errors.end(); } | 
 | 37 |  | 
 | 38 |   const_iterator warn_begin() const { return Warnings.begin(); } | 
 | 39 |   const_iterator warn_end() const   { return Warnings.end(); } | 
 | 40 |  | 
| Ted Kremenek | 9c728dc | 2007-12-12 22:39:36 +0000 | [diff] [blame] | 41 |   virtual void HandleDiagnostic(Diagnostic &Diags, | 
 | 42 |                                 Diagnostic::Level DiagLevel, | 
 | 43 |                                 FullSourceLoc Pos, | 
| Ted Kremenek | 7a9d49f | 2007-12-11 21:27:55 +0000 | [diff] [blame] | 44 |                                 diag::kind ID, | 
| Ted Kremenek | 7a9d49f | 2007-12-11 21:27:55 +0000 | [diff] [blame] | 45 |                                 const std::string *Strs, | 
| Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 46 |                                 unsigned NumStrs, | 
 | 47 |                                 const SourceRange *Ranges,  | 
 | 48 |                                 unsigned NumRanges); | 
 | 49 | }; | 
 | 50 |  | 
 | 51 | } // end namspace clang | 
 | 52 |  | 
 | 53 | #endif |