souffle  2.0.2-371-g6315b36
Public Member Functions | Private Attributes | Friends
souffle::ErrorReport Class Reference

#include <ErrorReport.h>

Collaboration diagram for souffle::ErrorReport:
Collaboration graph

Public Member Functions

void addDiagnostic (const Diagnostic &diagnostic)
 
void addError (const std::string &message, SrcLocation location)
 Adds an error with the given message and location. More...
 
void addWarning (const std::string &message, SrcLocation location)
 Adds a warning with the given message and location. More...
 
 ErrorReport (bool nowarn=false)
 
 ErrorReport (const ErrorReport &other)=default
 
void exitIfErrors ()
 
unsigned getNumErrors () const
 
unsigned getNumIssues () const
 
unsigned getNumWarnings () const
 
void print (std::ostream &out) const
 

Private Attributes

std::set< Diagnosticdiagnostics
 
bool nowarn
 

Friends

std::ostream & operator<< (std::ostream &out, const ErrorReport &report)
 

Detailed Description

Definition at line 152 of file ErrorReport.h.

Constructor & Destructor Documentation

◆ ErrorReport() [1/2]

souffle::ErrorReport::ErrorReport ( bool  nowarn = false)
inline

Definition at line 154 of file ErrorReport.h.

154 { return d.getType() == Diagnostic::Type::ERROR; });

◆ ErrorReport() [2/2]

souffle::ErrorReport::ErrorReport ( const ErrorReport other)
default

Member Function Documentation

◆ addDiagnostic()

void souffle::ErrorReport::addDiagnostic ( const Diagnostic diagnostic)
inline

Definition at line 186 of file ErrorReport.h.

◆ addError()

void souffle::ErrorReport::addError ( const std::string &  message,
SrcLocation  location 
)
inline

◆ addWarning()

void souffle::ErrorReport::addWarning ( const std::string &  message,
SrcLocation  location 
)
inline

Adds a warning with the given message and location.

Definition at line 179 of file ErrorReport.h.

180  {
181  diagnostics.insert(diagnostic);
182  }
183 
184  void exitIfErrors() {

References diagnostics.

◆ exitIfErrors()

void souffle::ErrorReport::exitIfErrors ( )
inline

Definition at line 190 of file ErrorReport.h.

193  {
194  for (const Diagnostic& diagnostic : diagnostics) {
195  out << diagnostic;
196  }
197  }

◆ getNumErrors()

unsigned souffle::ErrorReport::getNumErrors ( ) const
inline

Definition at line 158 of file ErrorReport.h.

159  { return d.getType() == Diagnostic::Type::WARNING; });
160  }
161 

◆ getNumIssues()

unsigned souffle::ErrorReport::getNumIssues ( ) const
inline

Definition at line 168 of file ErrorReport.h.

◆ getNumWarnings()

unsigned souffle::ErrorReport::getNumWarnings ( ) const
inline

Definition at line 163 of file ErrorReport.h.

◆ print()

void souffle::ErrorReport::print ( std::ostream &  out) const
inline

Definition at line 199 of file ErrorReport.h.

199  {
200  report.print(out);
201  return out;
202  }
203 

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const ErrorReport report 
)
friend

Definition at line 205 of file ErrorReport.h.

Field Documentation

◆ diagnostics

std::set<Diagnostic> souffle::ErrorReport::diagnostics
private

Definition at line 211 of file ErrorReport.h.

Referenced by addError(), and addWarning().

◆ nowarn

bool souffle::ErrorReport::nowarn
private

Definition at line 212 of file ErrorReport.h.

Referenced by addError().


The documentation for this class was generated from the following file:
souffle::Diagnostic::Type::ERROR
@ ERROR
souffle::ErrorReport::nowarn
bool nowarn
Definition: ErrorReport.h:212
souffle::ErrorReport::diagnostics
std::set< Diagnostic > diagnostics
Definition: ErrorReport.h:211
d
else d
Definition: htmlJsChartistMin.h:15
souffle::ErrorReport::exitIfErrors
void exitIfErrors()
Definition: ErrorReport.h:190
souffle::Diagnostic::Type::WARNING
@ WARNING