Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::Error Class Reference

#include <thorin/util/dbg.h>

Inheritance diagram for thorin::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 thorin::Error::Tag
strong
Enumerator
Error 
Warn 
Note 

Definition at line 19 of file dbg.h.

Constructor & Destructor Documentation

◆ Error() [1/4]

thorin::Error::Error ( )
default

◆ Error() [2/4]

thorin::Error::Error ( const Error )
default

◆ Error() [3/4]

thorin::Error::Error ( Error &&  other)
inline

Definition at line 40 of file dbg.h.

References swap.

◆ Error() [4/4]

thorin::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 thorin::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 thorin::print().

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

◆ clear()

void thorin::Error::clear ( )

Definition at line 7 of file dbg.cpp.

◆ error()

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

◆ msg()

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

Definition at line 65 of file dbg.h.

References thorin::fmt().

◆ msgs()

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

Definition at line 53 of file dbg.h.

◆ note()

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

◆ num_errors()

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

Definition at line 58 of file dbg.h.

◆ num_msgs()

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

Definition at line 54 of file dbg.h.

◆ num_notes()

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

Definition at line 60 of file dbg.h.

◆ num_warnings()

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

Definition at line 59 of file dbg.h.

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

◆ warn()

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

Definition at line 72 of file dbg.h.

Referenced by thorin::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: