1affc150dc44fab1911775a49636d0ce85333b634Zonr Chang//===- DiagnosticPrinter.h ------------------------------------------------===//
2affc150dc44fab1911775a49636d0ce85333b634Zonr Chang//
3affc150dc44fab1911775a49636d0ce85333b634Zonr Chang//                     The MCLinker Project
4affc150dc44fab1911775a49636d0ce85333b634Zonr Chang//
5affc150dc44fab1911775a49636d0ce85333b634Zonr Chang// This file is distributed under the University of Illinois Open Source
6affc150dc44fab1911775a49636d0ce85333b634Zonr Chang// License. See LICENSE.TXT for details.
7affc150dc44fab1911775a49636d0ce85333b634Zonr Chang//
8affc150dc44fab1911775a49636d0ce85333b634Zonr Chang//===----------------------------------------------------------------------===//
9affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#ifndef MCLD_DIAGNOSTIC_PRINTER_H
10affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#define MCLD_DIAGNOSTIC_PRINTER_H
11affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#ifdef ENABLE_UNITTEST
12affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#include <gtest.h>
13affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#endif
14affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#include <mcld/LD/DiagnosticEngine.h>
15affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#include <mcld/LD/Diagnostic.h>
16affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
17affc150dc44fab1911775a49636d0ce85333b634Zonr Changnamespace mcld
18affc150dc44fab1911775a49636d0ce85333b634Zonr Chang{
19affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
20affc150dc44fab1911775a49636d0ce85333b634Zonr Chang/** \class DiagnosticPrinter
21affc150dc44fab1911775a49636d0ce85333b634Zonr Chang *  \brief DiagnosticPrinter provides the interface to customize diagnostic
22affc150dc44fab1911775a49636d0ce85333b634Zonr Chang *  messages and output.
23affc150dc44fab1911775a49636d0ce85333b634Zonr Chang */
24affc150dc44fab1911775a49636d0ce85333b634Zonr Changclass DiagnosticPrinter
25affc150dc44fab1911775a49636d0ce85333b634Zonr Chang{
26affc150dc44fab1911775a49636d0ce85333b634Zonr Changpublic:
27affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  DiagnosticPrinter();
28affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
29affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  virtual ~DiagnosticPrinter();
30affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
31affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  virtual void beginInput(const Input& pInput, const MCLDInfo& pLDInfo) {}
32affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
33affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  virtual void endInput() {}
34affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
35affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  virtual void finish() {}
36affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
37affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  virtual void clear()
38affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  { m_NumErrors = m_NumWarnings = 0; }
39affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
40affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
41affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  /// capturing it to a log as needed.
42affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  virtual void handleDiagnostic(DiagnosticEngine::Severity pSeverity,
43affc150dc44fab1911775a49636d0ce85333b634Zonr Chang                                const Diagnostic& pInfo);
44affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
45affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  unsigned int getNumErrors() const
46affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  { return m_NumErrors; }
47affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
48affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  unsigned int getNumWarnings() const
49affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  { return m_NumWarnings; }
50affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
51affc150dc44fab1911775a49636d0ce85333b634Zonr Changprotected:
52affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  unsigned int m_NumErrors;
53affc150dc44fab1911775a49636d0ce85333b634Zonr Chang  unsigned int m_NumWarnings;
54affc150dc44fab1911775a49636d0ce85333b634Zonr Chang};
55affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
56affc150dc44fab1911775a49636d0ce85333b634Zonr Chang} // namespace of mcld
57affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
58affc150dc44fab1911775a49636d0ce85333b634Zonr Chang#endif
59affc150dc44fab1911775a49636d0ce85333b634Zonr Chang
60