MLIR
20.0.0git
|
This class is a utility diagnostic handler for use with llvm::SourceMgr. More...
#include "mlir/IR/Diagnostics.h"
Public Types | |
using | ShouldShowLocFn = llvm::unique_function< bool(Location)> |
This type represents a functor used to filter out locations when printing a diagnostic. More... | |
Public Member Functions | |
SourceMgrDiagnosticHandler (llvm::SourceMgr &mgr, MLIRContext *ctx, raw_ostream &os, ShouldShowLocFn &&shouldShowLocFn={}) | |
SourceMgrDiagnosticHandler (llvm::SourceMgr &mgr, MLIRContext *ctx, ShouldShowLocFn &&shouldShowLocFn={}) | |
~SourceMgrDiagnosticHandler () | |
void | emitDiagnostic (Location loc, Twine message, DiagnosticSeverity kind, bool displaySourceLine=true) |
Emit the given diagnostic information with the held source manager. More... | |
Public Member Functions inherited from mlir::ScopedDiagnosticHandler | |
ScopedDiagnosticHandler (MLIRContext *ctx) | |
template<typename FuncTy > | |
ScopedDiagnosticHandler (MLIRContext *ctx, FuncTy &&handler) | |
~ScopedDiagnosticHandler () | |
Protected Member Functions | |
void | emitDiagnostic (Diagnostic &diag) |
Emit the given diagnostic with the held source manager. More... | |
const llvm::MemoryBuffer * | getBufferForFile (StringRef filename) |
Get a memory buffer for the given file, or nullptr if no file is available. More... | |
Protected Member Functions inherited from mlir::ScopedDiagnosticHandler | |
template<typename FuncTy > | |
void | setHandler (FuncTy &&handler) |
Set the handler to manage via RAII. More... | |
Protected Attributes | |
llvm::SourceMgr & | mgr |
The source manager that we are wrapping. More... | |
raw_ostream & | os |
The output stream to use when printing diagnostics. More... | |
ShouldShowLocFn | shouldShowLocFn |
A functor used when determining if a location for a diagnostic should be shown. More... | |
This class is a utility diagnostic handler for use with llvm::SourceMgr.
Definition at line 559 of file Diagnostics.h.
using mlir::SourceMgrDiagnosticHandler::ShouldShowLocFn = llvm::unique_function<bool(Location)> |
This type represents a functor used to filter out locations when printing a diagnostic.
It should return true if the provided location is okay to display, false otherwise. If all locations in a diagnostic are filtered out, the first location is used as the sole location. When deciding whether or not to filter a location, this function should not recurse into any nested location. This recursion is handled automatically by the caller.
Definition at line 568 of file Diagnostics.h.
SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler | ( | llvm::SourceMgr & | mgr, |
MLIRContext * | ctx, | ||
raw_ostream & | os, | ||
ShouldShowLocFn && | shouldShowLocFn = {} |
||
) |
Definition at line 425 of file Diagnostics.cpp.
References diag(), emitDiagnostic(), and mlir::ScopedDiagnosticHandler::setHandler().
SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler | ( | llvm::SourceMgr & | mgr, |
MLIRContext * | ctx, | ||
ShouldShowLocFn && | shouldShowLocFn = {} |
||
) |
Definition at line 434 of file Diagnostics.cpp.
|
default |
|
protected |
Emit the given diagnostic with the held source manager.
Definition at line 477 of file Diagnostics.cpp.
References diag(), emitDiagnostic(), getCallSiteLoc(), and mlir::Note.
void SourceMgrDiagnosticHandler::emitDiagnostic | ( | Location | loc, |
Twine | message, | ||
DiagnosticSeverity | kind, | ||
bool | displaySourceLine = true |
||
) |
Emit the given diagnostic information with the held source manager.
Definition at line 441 of file Diagnostics.cpp.
References diag(), mlir::LocationAttr::findInstanceOf(), getDiagKind(), mgr, and os.
Referenced by emitDiagnostic(), and SourceMgrDiagnosticHandler().
|
protected |
Get a memory buffer for the given file, or nullptr if no file is available.
Get a memory buffer for the given file, or nullptr if one is not found.
Definition at line 524 of file Diagnostics.cpp.
References mgr.
|
protected |
The source manager that we are wrapping.
Definition at line 590 of file Diagnostics.h.
Referenced by emitDiagnostic(), getBufferForFile(), mlir::SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(), and mlir::SourceMgrDiagnosticVerifierHandler::verify().
|
protected |
The output stream to use when printing diagnostics.
Definition at line 593 of file Diagnostics.h.
Referenced by emitDiagnostic(), and mlir::SourceMgrDiagnosticVerifierHandler::verify().
|
protected |
A functor used when determining if a location for a diagnostic should be shown.
If null, all locations should be shown.
Definition at line 597 of file Diagnostics.h.