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 | // |
| 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 | |
| 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 | |
Chris Lattner | 0750618 | 2007-11-30 22:53:43 +0000 | [diff] [blame] | 41 | virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel, |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 42 | SourceLocation Pos, |
Ted Kremenek | 7a9d49f | 2007-12-11 21:27:55 +0000 | [diff] [blame] | 43 | diag::kind ID, |
Ted Kremenek | 2eefd86 | 2007-12-11 22:57:35 +0000 | [diff] [blame] | 44 | SourceManager* SrcMgr, |
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 |