DiagnosticPrinter.cpp revision 37b74a387bb3993387029859c2d9d051c41c724e
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
11namespace mcld {
12
13//===----------------------------------------------------------------------===//
14// DiagnosticPrinter
15//===----------------------------------------------------------------------===//
16DiagnosticPrinter::DiagnosticPrinter() : m_NumErrors(0), m_NumWarnings(0) {
17}
18
19DiagnosticPrinter::~DiagnosticPrinter() {
20  clear();
21}
22
23/// HandleDiagnostic - Handle this diagnostic, reporting it to the user or
24/// capturing it to a log as needed.
25void 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