clang API Documentation
00001 //===--- TextDiagnosticBuffer.h - Buffer Text Diagnostics -------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This is a concrete diagnostic client, which buffers the diagnostic messages. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H 00015 #define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H 00016 00017 #include "clang/Basic/Diagnostic.h" 00018 #include <vector> 00019 00020 namespace clang { 00021 00022 class Preprocessor; 00023 class SourceManager; 00024 00025 class TextDiagnosticBuffer : public DiagnosticConsumer { 00026 public: 00027 typedef std::vector<std::pair<SourceLocation, std::string> > DiagList; 00028 typedef DiagList::iterator iterator; 00029 typedef DiagList::const_iterator const_iterator; 00030 private: 00031 DiagList Errors, Warnings, Remarks, Notes; 00032 public: 00033 const_iterator err_begin() const { return Errors.begin(); } 00034 const_iterator err_end() const { return Errors.end(); } 00035 00036 const_iterator warn_begin() const { return Warnings.begin(); } 00037 const_iterator warn_end() const { return Warnings.end(); } 00038 00039 const_iterator remark_begin() const { return Remarks.begin(); } 00040 const_iterator remark_end() const { return Remarks.end(); } 00041 00042 const_iterator note_begin() const { return Notes.begin(); } 00043 const_iterator note_end() const { return Notes.end(); } 00044 00045 void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, 00046 const Diagnostic &Info) override; 00047 00048 /// FlushDiagnostics - Flush the buffered diagnostics to an given 00049 /// diagnostic engine. 00050 void FlushDiagnostics(DiagnosticsEngine &Diags) const; 00051 }; 00052 00053 } // end namspace clang 00054 00055 #endif