MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches

#include <mim/util/dbg.h>

Inheritance diagram for mim::Error:
[legend]

Classes

struct  Msg

Public Types

enum class  Tag {
  Error ,
  Warn ,
  Note
}

Public Member Functions

const char * what () const noexcept override
Constructors
 Error ()=default
 Error (Loc loc, const std::string &str)
 Creates a single Tag::Error message.
Getters
const auto & msgs () const
size_t num_msgs () const
size_t num_errors () const
size_t num_warnings () const
size_t num_notes () const
Add formatted message
template<class... Args>
Errormsg (Loc loc, Tag tag, std::format_string< Args... > s, Args &&... args)
template<class... Args>
Errorerror (Loc loc, std::format_string< Args... > s, Args &&... args)
template<class... Args>
Errorwarn (Loc loc, std::format_string< Args... > s, Args &&... args)
template<class... Args>
Errornote (Loc loc, std::format_string< Args... > s, Args &&... args)
Handle Errors/Warnings
void clear ()
void ack (std::ostream &os=std::cerr)
 If errors occurred, claim them and throw; if warnings occurred, claim them and report to os.

Friends

std::ostream & operator<< (std::ostream &o, Tag tag)
std::ostream & operator<< (std::ostream &os, const Error &e)

Detailed Description

Definition at line 25 of file dbg.h.

Member Enumeration Documentation

◆ Tag

enum class mim::Error::Tag
strong
Enumerator
Error 
Warn 
Note 

Definition at line 27 of file dbg.h.

Constructor & Destructor Documentation

◆ Error() [1/2]

mim::Error::Error ( )
default

Referenced by Error, error(), msg(), note(), operator<<, and warn().

◆ Error() [2/2]

mim::Error::Error ( Loc loc,
const std::string & str )
inline

Creates a single Tag::Error message.

Definition at line 45 of file dbg.h.

References Error.

Member Function Documentation

◆ ack()

void mim::Error::ack ( std::ostream & os = std::cerr)

If errors occurred, claim them and throw; if warnings occurred, claim them and report to os.

Definition at line 10 of file dbg.cpp.

◆ clear()

void mim::Error::clear ( )

Definition at line 7 of file dbg.cpp.

◆ error()

template<class... Args>
Error & mim::Error::error ( Loc loc,
std::format_string< Args... > s,
Args &&... args )
inline

◆ msg()

template<class... Args>
Error & mim::Error::msg ( Loc loc,
Tag tag,
std::format_string< Args... > s,
Args &&... args )
inline

Definition at line 63 of file dbg.h.

References Error().

Referenced by error(), note(), mim::Error::Msg::operator<<, operator<<, and warn().

◆ msgs()

const auto & mim::Error::msgs ( ) const
inline

Definition at line 53 of file dbg.h.

◆ note()

template<class... Args>
Error & mim::Error::note ( Loc loc,
std::format_string< Args... > s,
Args &&... args )
inline

◆ num_errors()

size_t mim::Error::num_errors ( ) const
inline

Definition at line 55 of file dbg.h.

References Error, and mim::Error::Msg::tag.

Referenced by note().

◆ num_msgs()

size_t mim::Error::num_msgs ( ) const
inline

Definition at line 54 of file dbg.h.

◆ num_notes()

size_t mim::Error::num_notes ( ) const
inline

Definition at line 57 of file dbg.h.

References Note, and mim::Error::Msg::tag.

◆ num_warnings()

size_t mim::Error::num_warnings ( ) const
inline

Definition at line 56 of file dbg.h.

References mim::Error::Msg::tag, and Warn.

Referenced by note().

◆ warn()

template<class... Args>
Error & mim::Error::warn ( Loc loc,
std::format_string< Args... > s,
Args &&... args )
inline

Definition at line 70 of file dbg.h.

References Error(), msg(), and Warn.

Referenced by mim::ast::AST::warn().

◆ what()

const char * mim::Error::what ( ) const
inlineoverridenoexcept

Definition at line 85 of file dbg.h.

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & o,
Tag tag )
friend

Definition at line 94 of file dbg.h.

References Error, Note, and Warn.

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream & os,
const Error & e )
friend

Definition at line 105 of file dbg.h.

References Error(), and msg().


The documentation for this class was generated from the following files: