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

#include <ErrorReport.h>

Collaboration diagram for souffle::Diagnostic:
Collaboration graph

Public Types

enum  Type { Type::ERROR, Type::WARNING }
 

Public Member Functions

 Diagnostic (Type type, DiagnosticMessage primaryMessage)
 
 Diagnostic (Type type, DiagnosticMessage primaryMessage, std::vector< DiagnosticMessage > additionalMessages)
 
const std::vector< DiagnosticMessage > & getAdditionalMessages () const
 
const DiagnosticMessagegetPrimaryMessage () const
 
Type getType () const
 
bool operator< (const Diagnostic &other) const
 
void print (std::ostream &out) const
 

Private Attributes

std::vector< DiagnosticMessageadditionalMessages
 
DiagnosticMessage primaryMessage
 
Type type
 

Friends

std::ostream & operator<< (std::ostream &out, const Diagnostic &diagnostic)
 

Detailed Description

Definition at line 76 of file ErrorReport.h.

Member Enumeration Documentation

◆ Type

Enumerator
ERROR 
WARNING 

Definition at line 78 of file ErrorReport.h.

79 : type(type), primaryMessage(std::move(primaryMessage)) {}

Constructor & Destructor Documentation

◆ Diagnostic() [1/2]

souffle::Diagnostic::Diagnostic ( Type  type,
DiagnosticMessage  primaryMessage,
std::vector< DiagnosticMessage additionalMessages 
)
inline

Definition at line 80 of file ErrorReport.h.

81  {
82  return type;

References type.

◆ Diagnostic() [2/2]

souffle::Diagnostic::Diagnostic ( Type  type,
DiagnosticMessage  primaryMessage 
)
inline

Definition at line 84 of file ErrorReport.h.

85  {

References primaryMessage.

Member Function Documentation

◆ getAdditionalMessages()

const std::vector<DiagnosticMessage>& souffle::Diagnostic::getAdditionalMessages ( ) const
inline

Definition at line 95 of file ErrorReport.h.

97  out << additionalMessage;

◆ getPrimaryMessage()

const DiagnosticMessage& souffle::Diagnostic::getPrimaryMessage ( ) const
inline

Definition at line 91 of file ErrorReport.h.

93  {

◆ getType()

Type souffle::Diagnostic::getType ( ) const
inline

Definition at line 87 of file ErrorReport.h.

89  {

◆ operator<()

bool souffle::Diagnostic::operator< ( const Diagnostic other) const
inline

Definition at line 112 of file ErrorReport.h.

114  {
115  if (primaryMessage.getLocation() < other.primaryMessage.getLocation()) {
116  return true;
117  }
118  if (other.primaryMessage.getLocation() < primaryMessage.getLocation()) {
119  return false;
120  }
121  }
122 
123  if (type == Type::ERROR && other.getType() == Type::WARNING) {
124  return true;
125  }
126  if (other.getType() == Type::ERROR && type == Type::WARNING) {
127  return false;
128  }
129 
130  if (primaryMessage.getMessage() < other.primaryMessage.getMessage()) {
131  return true;
132  }
133  if (other.primaryMessage.getMessage() < primaryMessage.getMessage()) {
134  return false;
135  }
136 
137  return false;
138  }
139 
140 private:
141  Type type;
142  DiagnosticMessage primaryMessage;
143  std::vector<DiagnosticMessage> additionalMessages;
144 };

◆ print()

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

Definition at line 99 of file ErrorReport.h.

101  {
102  diagnostic.print(out);
103  return out;
104  }
105 

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Diagnostic diagnostic 
)
friend

Definition at line 107 of file ErrorReport.h.

107  {
108  return true;
109  }
110  if (other.primaryMessage.hasLocation() && !primaryMessage.hasLocation()) {

Field Documentation

◆ additionalMessages

std::vector<DiagnosticMessage> souffle::Diagnostic::additionalMessages
private

Definition at line 149 of file ErrorReport.h.

◆ primaryMessage

DiagnosticMessage souffle::Diagnostic::primaryMessage
private

Definition at line 148 of file ErrorReport.h.

Referenced by Diagnostic().

◆ type

Type souffle::Diagnostic::type
private

Definition at line 147 of file ErrorReport.h.

Referenced by Diagnostic().


The documentation for this class was generated from the following file:
souffle::Diagnostic::type
Type type
Definition: ErrorReport.h:147
souffle::Diagnostic::Type::ERROR
@ ERROR
souffle::Diagnostic::Type
Type
Definition: ErrorReport.h:78
souffle::DiagnosticMessage::hasLocation
bool hasLocation() const
Definition: ErrorReport.h:59
souffle::DiagnosticMessage::getMessage
const std::string & getMessage() const
Definition: ErrorReport.h:50
souffle::Diagnostic::additionalMessages
std::vector< DiagnosticMessage > additionalMessages
Definition: ErrorReport.h:149
souffle::Diagnostic::Type::WARNING
@ WARNING
souffle::Diagnostic::primaryMessage
DiagnosticMessage primaryMessage
Definition: ErrorReport.h:148
souffle::DiagnosticMessage::getLocation
const SrcLocation & getLocation() const
Definition: ErrorReport.h:54