1 //===- DiagnosticPrinter.cpp ----------------------------------------------===//
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 #include "mcld/LD/DiagnosticPrinter.h"
10 
11 namespace mcld {
12 
13 //===----------------------------------------------------------------------===//
14 // DiagnosticPrinter
15 //===----------------------------------------------------------------------===//
DiagnosticPrinter()16 DiagnosticPrinter::DiagnosticPrinter() : m_NumErrors(0), m_NumWarnings(0) {
17 }
18 
~DiagnosticPrinter()19 DiagnosticPrinter::~DiagnosticPrinter() {
20   clear();
21 }
22 
23 /// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
24 /// capturing it to a log as needed.
handleDiagnostic(DiagnosticEngine::Severity pSeverity,const Diagnostic & pInfo)25 void DiagnosticPrinter::handleDiagnostic(DiagnosticEngine::Severity pSeverity,
26                                          const Diagnostic& pInfo) {
27   if (pSeverity == DiagnosticEngine::Warning)
28     ++m_NumWarnings;
29 
30   if (pSeverity <= DiagnosticEngine::Error)
31     ++m_NumErrors;
32 }
33 
34 }  // namespace mcld
35