1//===- MsgHandling.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_MESSAGE_HANDLING_H 10#define MCLD_MESSAGE_HANDLING_H 11#ifdef ENABLE_UNITTEST 12#include <gtest.h> 13#endif 14#include <mcld/LD/MsgHandler.h> 15 16namespace mcld 17{ 18 19class MCLDInfo; 20class DiagnosticPrinter; 21class DiagnosticLineInfo; 22 23void InitializeDiagnosticEngine(const MCLDInfo& pLDInfo, 24 DiagnosticLineInfo* pLineInfo, 25 DiagnosticPrinter* pPrinter); 26 27DiagnosticEngine& getDiagnosticEngine(); 28 29MsgHandler unreachable(unsigned int pID); 30MsgHandler fatal(unsigned int pID); 31MsgHandler error(unsigned int pID); 32MsgHandler warning(unsigned int pID); 33MsgHandler debug(unsigned int pID); 34MsgHandler note(unsigned int pID); 35MsgHandler ignore(unsigned int pID); 36 37} // namespace of mcld 38 39//===----------------------------------------------------------------------===// 40// Inline functions 41inline mcld::MsgHandler mcld::unreachable(unsigned int pID) 42{ 43 return getDiagnosticEngine().report(pID, DiagnosticEngine::Unreachable); 44} 45 46inline mcld::MsgHandler mcld::fatal(unsigned int pID) 47{ 48 return getDiagnosticEngine().report(pID, DiagnosticEngine::Fatal); 49} 50 51inline mcld::MsgHandler mcld::error(unsigned int pID) 52{ 53 return getDiagnosticEngine().report(pID, DiagnosticEngine::Error); 54} 55 56inline mcld::MsgHandler mcld::warning(unsigned int pID) 57{ 58 return getDiagnosticEngine().report(pID, DiagnosticEngine::Warning); 59} 60 61inline mcld::MsgHandler mcld::debug(unsigned int pID) 62{ 63 return getDiagnosticEngine().report(pID, DiagnosticEngine::Debug); 64} 65 66inline mcld::MsgHandler mcld::note(unsigned int pID) 67{ 68 return getDiagnosticEngine().report(pID, DiagnosticEngine::Note); 69} 70 71inline mcld::MsgHandler mcld::ignore(unsigned int pID) 72{ 73 return getDiagnosticEngine().report(pID, DiagnosticEngine::Ignore); 74} 75 76#endif 77 78