1//===- DiagnosticPrinter.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_LD_DIAGNOSTICPRINTER_H_ 10#define MCLD_LD_DIAGNOSTICPRINTER_H_ 11 12#include "mcld/LD/Diagnostic.h" 13#include "mcld/LD/DiagnosticEngine.h" 14 15namespace mcld { 16 17/** \class DiagnosticPrinter 18 * \brief DiagnosticPrinter provides the interface to customize diagnostic 19 * messages and output. 20 */ 21class DiagnosticPrinter { 22 public: 23 DiagnosticPrinter(); 24 25 virtual ~DiagnosticPrinter(); 26 27 virtual void beginInput(const Input& pInput, const LinkerConfig& pConfig) {} 28 29 virtual void endInput() {} 30 31 virtual void finish() {} 32 33 virtual void clear() { m_NumErrors = m_NumWarnings = 0; } 34 35 /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or 36 /// capturing it to a log as needed. 37 virtual void handleDiagnostic(DiagnosticEngine::Severity pSeverity, 38 const Diagnostic& pInfo); 39 40 unsigned int getNumErrors() const { return m_NumErrors; } 41 unsigned int getNumWarnings() const { return m_NumWarnings; } 42 43 protected: 44 unsigned int m_NumErrors; 45 unsigned int m_NumWarnings; 46}; 47 48} // namespace mcld 49 50#endif // MCLD_LD_DIAGNOSTICPRINTER_H_ 51