Home | History | Annotate | Download | only in Support
      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_SUPPORT_MSGHANDLING_H_
     10 #define MCLD_SUPPORT_MSGHANDLING_H_
     11 #include "mcld/LD/MsgHandler.h"
     12 
     13 namespace mcld {
     14 
     15 class LinkerConfig;
     16 class DiagnosticPrinter;
     17 class DiagnosticLineInfo;
     18 
     19 void InitializeDiagnosticEngine(const LinkerConfig& pConfig,
     20                                 DiagnosticPrinter* pPrinter = NULL);
     21 
     22 void FinalizeDiagnosticEngine();
     23 
     24 bool Diagnose();
     25 
     26 DiagnosticEngine& getDiagnosticEngine();
     27 
     28 MsgHandler unreachable(unsigned int pID);
     29 MsgHandler fatal(unsigned int pID);
     30 MsgHandler error(unsigned int pID);
     31 MsgHandler warning(unsigned int pID);
     32 MsgHandler debug(unsigned int pID);
     33 MsgHandler note(unsigned int pID);
     34 MsgHandler ignore(unsigned int pID);
     35 
     36 }  // namespace mcld
     37 
     38 //===----------------------------------------------------------------------===//
     39 //  Inline functions
     40 //===----------------------------------------------------------------------===//
     41 inline mcld::MsgHandler mcld::unreachable(unsigned int pID) {
     42   return getDiagnosticEngine().report(pID, DiagnosticEngine::Unreachable);
     43 }
     44 
     45 inline mcld::MsgHandler mcld::fatal(unsigned int pID) {
     46   return getDiagnosticEngine().report(pID, DiagnosticEngine::Fatal);
     47 }
     48 
     49 inline mcld::MsgHandler mcld::error(unsigned int pID) {
     50   return getDiagnosticEngine().report(pID, DiagnosticEngine::Error);
     51 }
     52 
     53 inline mcld::MsgHandler mcld::warning(unsigned int pID) {
     54   return getDiagnosticEngine().report(pID, DiagnosticEngine::Warning);
     55 }
     56 
     57 inline mcld::MsgHandler mcld::debug(unsigned int pID) {
     58   return getDiagnosticEngine().report(pID, DiagnosticEngine::Debug);
     59 }
     60 
     61 inline mcld::MsgHandler mcld::note(unsigned int pID) {
     62   return getDiagnosticEngine().report(pID, DiagnosticEngine::Note);
     63 }
     64 
     65 inline mcld::MsgHandler mcld::ignore(unsigned int pID) {
     66   return getDiagnosticEngine().report(pID, DiagnosticEngine::Ignore);
     67 }
     68 
     69 #endif  // MCLD_SUPPORT_MSGHANDLING_H_
     70