1 //===- TextDiagnosticPrinter.h --------------------------------------------===// 2 // 3 // The MCLinker Project 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #ifndef MCLD_TEXT_DIAGNOSTIC_PRINTER_H 10 #define MCLD_TEXT_DIAGNOSTIC_PRINTER_H 11 #ifdef ENABLE_UNITTEST 12 #include <gtest.h> 13 #endif 14 #include <mcld/LD/DiagnosticPrinter.h> 15 #include <llvm/Support/raw_ostream.h> 16 17 namespace mcld 18 { 19 20 class LinkerConfig; 21 22 /** \class TextDiagnosticPrinter 23 * \brief The plain, text-based DiagnosticPrinter. 24 */ 25 class TextDiagnosticPrinter : public DiagnosticPrinter 26 { 27 public: 28 TextDiagnosticPrinter(llvm::raw_ostream& pOStream, const LinkerConfig& pConfig); 29 30 virtual ~TextDiagnosticPrinter(); 31 32 /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or 33 /// capturing it to a log as needed. 34 virtual void handleDiagnostic(DiagnosticEngine::Severity pSeverity, 35 const Diagnostic& pInfo); 36 37 virtual void beginInput(const Input& pInput, const LinkerConfig& pConfig); 38 39 virtual void endInput(); 40 41 private: 42 llvm::raw_ostream& m_OStream; 43 const LinkerConfig& m_Config; 44 const Input* m_pInput; 45 }; 46 47 } // namespace of mcld 48 49 #endif 50 51