MLIR
20.0.0git
|
This class contains all of the information necessary to report a diagnostic to the DiagnosticEngine. More...
#include "mlir/IR/Diagnostics.h"
Public Types | |
using | note_iterator = llvm::pointee_iterator< NoteVector::iterator > |
using | const_note_iterator = llvm::pointee_iterator< NoteVector::const_iterator > |
Public Member Functions | |
Diagnostic (Location loc, DiagnosticSeverity severity) | |
Diagnostic (Diagnostic &&)=default | |
Diagnostic & | operator= (Diagnostic &&)=default |
DiagnosticSeverity | getSeverity () const |
Returns the severity of this diagnostic. More... | |
Location | getLocation () const |
Returns the source location for this diagnostic. More... | |
MutableArrayRef< DiagnosticArgument > | getArguments () |
Returns the current list of diagnostic arguments. More... | |
ArrayRef< DiagnosticArgument > | getArguments () const |
template<typename Arg > | |
std::enable_if_t<!std::is_convertible< Arg, StringRef >::value &&std::is_constructible< DiagnosticArgument, Arg >::value, Diagnostic & > | operator<< (Arg &&val) |
Stream operator for inserting new diagnostic arguments. More... | |
Diagnostic & | operator<< (StringAttr val) |
Diagnostic & | operator<< (const char *val) |
Stream in a string literal. More... | |
Diagnostic & | operator<< (char val) |
Stream in a Twine argument. More... | |
Diagnostic & | operator<< (const Twine &val) |
Diagnostic & | operator<< (Twine &&val) |
Diagnostic & | operator<< (OperationName val) |
Stream in an OperationName. More... | |
Diagnostic & | operator<< (Operation &op) |
Stream in an Operation. More... | |
Diagnostic & | operator<< (Operation *op) |
Diagnostic & | appendOp (Operation &op, const OpPrintingFlags &flags) |
Append an operation with the given printing flags. More... | |
Diagnostic & | operator<< (Value val) |
Stream in a Value. More... | |
template<typename T , typename ValueT = llvm::detail::ValueOfRange<T>> | |
std::enable_if_t<!std::is_constructible< DiagnosticArgument, T >::value, Diagnostic & > | operator<< (T &&range) |
Stream in a range. More... | |
template<typename T > | |
Diagnostic & | appendRange (const T &c, const char *delim=", ") |
Append a range to the diagnostic. More... | |
template<typename Arg1 , typename Arg2 , typename... Args> | |
Diagnostic & | append (Arg1 &&arg1, Arg2 &&arg2, Args &&...args) |
Append arguments to the diagnostic. More... | |
template<typename Arg > | |
Diagnostic & | append (Arg &&arg) |
Append one argument to the diagnostic. More... | |
void | print (raw_ostream &os) const |
Outputs this diagnostic to a stream. More... | |
std::string | str () const |
Converts the diagnostic to a string. More... | |
Diagnostic & | attachNote (std::optional< Location > noteLoc=std::nullopt) |
Attaches a note to this diagnostic. More... | |
iterator_range< note_iterator > | getNotes () |
Returns the notes held by this diagnostic. More... | |
iterator_range< const_note_iterator > | getNotes () const |
operator LogicalResult () const | |
Allow a diagnostic to be converted to 'failure'. More... | |
operator ParseResult () const | |
Allow a diagnostic to be converted to 'failure'. More... | |
template<typename T > | |
operator FailureOr< T > () const | |
Allow a diagnostic to be converted to FailureOr<T>. More... | |
SmallVectorImpl< DiagnosticArgument > & | getMetadata () |
Returns the current list of diagnostic metadata. More... | |
This class contains all of the information necessary to report a diagnostic to the DiagnosticEngine.
It should generally not be constructed directly, and instead used transitively via InFlightDiagnostic.
Definition at line 155 of file Diagnostics.h.
using mlir::Diagnostic::const_note_iterator = llvm::pointee_iterator<NoteVector::const_iterator> |
Definition at line 250 of file Diagnostics.h.
using mlir::Diagnostic::note_iterator = llvm::pointee_iterator<NoteVector::iterator> |
Definition at line 249 of file Diagnostics.h.
|
inline |
Definition at line 159 of file Diagnostics.h.
|
default |
|
inline |
Append one argument to the diagnostic.
Definition at line 233 of file Diagnostics.h.
|
inline |
Append arguments to the diagnostic.
Definition at line 227 of file Diagnostics.h.
Diagnostic & Diagnostic::appendOp | ( | Operation & | op, |
const OpPrintingFlags & | flags | ||
) |
Append an operation with the given printing flags.
Definition at line 141 of file Diagnostics.cpp.
|
inline |
Append a range to the diagnostic.
The default delimiter between elements is ','.
Definition at line 219 of file Diagnostics.h.
Diagnostic & Diagnostic::attachNote | ( | std::optional< Location > | noteLoc = std::nullopt | ) |
Attaches a note to this diagnostic.
A new location may be optionally provided, if not, then the location defaults to the one specified for this diagnostic. Notes may not be attached to other notes.
Append and return a new note.
Definition at line 177 of file Diagnostics.cpp.
References mlir::Note.
|
inline |
Returns the current list of diagnostic arguments.
Definition at line 171 of file Diagnostics.h.
Referenced by print().
|
inline |
Definition at line 172 of file Diagnostics.h.
|
inline |
Returns the source location for this diagnostic.
Definition at line 168 of file Diagnostics.h.
|
inline |
Returns the current list of diagnostic metadata.
Definition at line 275 of file Diagnostics.h.
|
inline |
Returns the notes held by this diagnostic.
Definition at line 254 of file Diagnostics.h.
|
inline |
Definition at line 257 of file Diagnostics.h.
|
inline |
Returns the severity of this diagnostic.
Definition at line 165 of file Diagnostics.h.
|
inline |
Allow a diagnostic to be converted to FailureOr<T>.
Always results in 'failure' because this cast cannot possibly return an object of 'T'.
Definition at line 270 of file Diagnostics.h.
Diagnostic::operator LogicalResult | ( | ) | const |
Allow a diagnostic to be converted to 'failure'.
Definition at line 193 of file Diagnostics.cpp.
|
inline |
Allow a diagnostic to be converted to 'failure'.
Definition at line 265 of file Diagnostics.h.
|
inline |
Stream operator for inserting new diagnostic arguments.
Definition at line 172 of file Diagnostics.h.
Diagnostic & Diagnostic::operator<< | ( | char | val | ) |
Stream in a Twine argument.
Definition at line 102 of file Diagnostics.cpp.
|
inline |
Stream in a string literal.
Definition at line 186 of file Diagnostics.h.
Diagnostic & Diagnostic::operator<< | ( | const Twine & | val | ) |
Definition at line 103 of file Diagnostics.cpp.
References twineToStrRef().
Diagnostic & Diagnostic::operator<< | ( | Operation & | op | ) |
Stream in an Operation.
Definition at line 137 of file Diagnostics.cpp.
|
inline |
Definition at line 201 of file Diagnostics.h.
Diagnostic & Diagnostic::operator<< | ( | OperationName | val | ) |
Stream in an OperationName.
Definition at line 118 of file Diagnostics.cpp.
References mlir::OperationName::getStringRef().
Diagnostic & Diagnostic::operator<< | ( | StringAttr | val | ) |
Definition at line 112 of file Diagnostics.cpp.
|
inline |
Stream in a range.
Definition at line 206 of file Diagnostics.h.
Diagnostic & Diagnostic::operator<< | ( | Twine && | val | ) |
Definition at line 107 of file Diagnostics.cpp.
References twineToStrRef().
Diagnostic & Diagnostic::operator<< | ( | Value | val | ) |
Stream in a Value.
Definition at line 153 of file Diagnostics.cpp.
References adjustPrintingFlags(), mlir::Value::print(), and str().
|
default |
void Diagnostic::print | ( | raw_ostream & | os | ) | const |
Outputs this diagnostic to a stream.
Definition at line 161 of file Diagnostics.cpp.
References getArguments().
Referenced by mlirAffineExprPrint(), mlirAffineMapPrint(), mlirDiagnosticPrint(), mlirIntegerSetPrint(), and str().
std::string Diagnostic::str | ( | ) | const |
Converts the diagnostic to a string.
Convert the diagnostic to a string.
Definition at line 167 of file Diagnostics.cpp.
References print().
Referenced by operator<<().