blob: a42bb54edc2911e90f7dc1c5244066d48809567b [file] [log] [blame]
//===- MsgHandling.h ------------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef MCLD_MESSAGE_HANDLING_H
#define MCLD_MESSAGE_HANDLING_H
#ifdef ENABLE_UNITTEST
#include <gtest.h>
#endif
#include <mcld/LD/MsgHandler.h>
namespace mcld
{
class MCLDInfo;
class DiagnosticPrinter;
class DiagnosticLineInfo;
void InitializeDiagnosticEngine(const MCLDInfo& pLDInfo,
DiagnosticLineInfo* pLineInfo,
DiagnosticPrinter* pPrinter);
DiagnosticEngine& getDiagnosticEngine();
MsgHandler unreachable(unsigned int pID);
MsgHandler fatal(unsigned int pID);
MsgHandler error(unsigned int pID);
MsgHandler warning(unsigned int pID);
MsgHandler debug(unsigned int pID);
MsgHandler note(unsigned int pID);
MsgHandler ignore(unsigned int pID);
} // namespace of mcld
//===----------------------------------------------------------------------===//
// Inline functions
inline mcld::MsgHandler mcld::unreachable(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Unreachable);
}
inline mcld::MsgHandler mcld::fatal(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Fatal);
}
inline mcld::MsgHandler mcld::error(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Error);
}
inline mcld::MsgHandler mcld::warning(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Warning);
}
inline mcld::MsgHandler mcld::debug(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Debug);
}
inline mcld::MsgHandler mcld::note(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Note);
}
inline mcld::MsgHandler mcld::ignore(unsigned int pID)
{
return getDiagnosticEngine().report(pID, DiagnosticEngine::Ignore);
}
#endif