• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
14 namespace mcld
15 {
16 
17 /** \class DiagnosticPrinter
18  *  \brief DiagnosticPrinter provides the interface to customize diagnostic
19  *  messages and output.
20  */
21 class DiagnosticPrinter
22 {
23 public:
24   DiagnosticPrinter();
25 
26   virtual ~DiagnosticPrinter();
27 
beginInput(const Input & pInput,const LinkerConfig & pConfig)28   virtual void beginInput(const Input& pInput, const LinkerConfig& pConfig) {}
29 
endInput()30   virtual void endInput() {}
31 
finish()32   virtual void finish() {}
33 
clear()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 
getNumErrors()42   unsigned int getNumErrors() const { return m_NumErrors; }
getNumWarnings()43   unsigned int getNumWarnings() const { return m_NumWarnings; }
44 
45 protected:
46   unsigned int m_NumErrors;
47   unsigned int m_NumWarnings;
48 };
49 
50 } // namespace of mcld
51 
52 #endif
53 
54