blob: 53a6cb7e60d7b84c0469cd5183fc56291f2c31ef [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- 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
20namespace clang {
21
22class Preprocessor;
23class SourceManager;
24
25class TextDiagnosticBuffer : public TextDiagnostics {
26public:
27 typedef std::vector<std::pair<SourceLocation, std::string> > DiagList;
28 typedef DiagList::iterator iterator;
29 typedef DiagList::const_iterator const_iterator;
30private:
31 DiagList Errors, Warnings;
32public:
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000033 TextDiagnosticBuffer() {}
Reid Spencer5f016e22007-07-11 17:01:13 +000034
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 Lattner07506182007-11-30 22:53:43 +000041 virtual void HandleDiagnostic(Diagnostic &Diags, Diagnostic::Level DiagLevel,
Reid Spencer5f016e22007-07-11 17:01:13 +000042 SourceLocation Pos,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000043 diag::kind ID,
Ted Kremenek2eefd862007-12-11 22:57:35 +000044 SourceManager* SrcMgr,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000045 const std::string *Strs,
Reid Spencer5f016e22007-07-11 17:01:13 +000046 unsigned NumStrs,
47 const SourceRange *Ranges,
48 unsigned NumRanges);
49};
50
51} // end namspace clang
52
53#endif