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