MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Error Class Reference

#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

Constructors
 Error ()=default
 
 Error (const Error &)=default
 
 Error (Error &&other)
 
 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, const char *s, Args &&... args)
 
template<class... Args>
Errorerror (Loc loc, const char *s, Args &&... args)
 
template<class... Args>
Errorwarn (Loc loc, const char *s, Args &&... args)
 
template<class... Args>
Errornote (Loc loc, const char *s, Args &&... args)
 
Handle Errors/Warnings
void clear ()
 
void ack (std::ostream &os=std::cerr)
 If errors occured, claim them and throw; if warnings occured, claim them and report to os.
 

Friends

std::ostream & operator<< (std::ostream &o, Tag tag)
 
std::ostream & operator<< (std::ostream &os, const Error &e)
 
void swap (Error &e1, Error &e2) noexcept
 

Detailed Description

Definition at line 17 of file dbg.h.

Member Enumeration Documentation

◆ Tag

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

Definition at line 19 of file dbg.h.

Constructor & Destructor Documentation

◆ Error() [1/4]

mim::Error::Error ( )
default

◆ Error() [2/4]

mim::Error::Error ( const Error & )
default

◆ Error() [3/4]

mim::Error::Error ( Error && other)
inline

Definition at line 40 of file dbg.h.

References swap.

◆ Error() [4/4]

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 occured, claim them and throw; if warnings occured, claim them and report to os.

Definition at line 15 of file dbg.cpp.

References mim::print().

Referenced by mim::ast::Module::compile().

◆ clear()

void mim::Error::clear ( )

Definition at line 7 of file dbg.cpp.

◆ error()

template<class... Args>
Error & mim::Error::error ( Loc loc,
const char * s,
Args &&... args )
inline

Definition at line 71 of file dbg.h.

Referenced by mim::World::app(), mim::Lam::check(), mim::ast::AST::error(), and mim::World::insert().

◆ msg()

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

Definition at line 65 of file dbg.h.

References mim::fmt().

◆ 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,
const char * s,
Args &&... args )
inline

Definition at line 73 of file dbg.h.

Referenced by mim::World::app(), mim::Lam::check(), mim::World::insert(), and mim::ast::AST::note().

◆ num_errors()

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

Definition at line 58 of file dbg.h.

◆ 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 60 of file dbg.h.

◆ num_warnings()

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

Definition at line 59 of file dbg.h.

Referenced by mim::ast::Module::compile().

◆ warn()

template<class... Args>
Error & mim::Error::warn ( Loc loc,
const char * s,
Args &&... args )
inline

Definition at line 72 of file dbg.h.

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

Friends And Related Symbol Documentation

◆ operator<< [1/2]

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

Definition at line 86 of file dbg.h.

◆ operator<< [2/2]

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

Definition at line 97 of file dbg.h.

◆ swap

void swap ( Error & e1,
Error & e2 )
friend

Definition at line 102 of file dbg.h.

Referenced by Error().


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