1 //===--- TextDiagnosticBuffer.h - Buffer Text Diagnostics -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This is a concrete diagnostic client, which buffers the diagnostic messages.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_BUFFER_H_
15 #define LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_BUFFER_H_
17 #include "clang/Basic/Diagnostic.h"
25 class TextDiagnosticBuffer : public DiagnosticConsumer {
27 typedef std::vector<std::pair<SourceLocation, std::string> > DiagList;
28 typedef DiagList::iterator iterator;
29 typedef DiagList::const_iterator const_iterator;
31 DiagList Errors, Warnings, Notes;
33 const_iterator err_begin() const { return Errors.begin(); }
34 const_iterator err_end() const { return Errors.end(); }
36 const_iterator warn_begin() const { return Warnings.begin(); }
37 const_iterator warn_end() const { return Warnings.end(); }
39 const_iterator note_begin() const { return Notes.begin(); }
40 const_iterator note_end() const { return Notes.end(); }
42 virtual void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
43 const Diagnostic &Info);
45 /// FlushDiagnostics - Flush the buffered diagnostics to an given
46 /// diagnostic engine.
47 void FlushDiagnostics(DiagnosticsEngine &Diags) const;
50 } // end namspace clang