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