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