blob: e0230cf70884c86e991a3e4a4ce99b747e5640d9 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- TextDiagnosticBuffer.h - Buffer Text Diagnostics -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
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
Ted Kremenek9c728dc2007-12-12 22:39:36 +000041 virtual void HandleDiagnostic(Diagnostic &Diags,
42 Diagnostic::Level DiagLevel,
43 FullSourceLoc Pos,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000044 diag::kind ID,
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