|
MLIR 22.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. | |
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. | |
| void | setCallStackLimit (unsigned limit) |
| Set the maximum depth that a call stack will be printed. Defaults to 10. | |
| 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. | |
| const llvm::MemoryBuffer * | getBufferForFile (StringRef filename) |
| Get a memory buffer for the given file, or nullptr if no file is available. | |
| Protected Member Functions inherited from mlir::ScopedDiagnosticHandler | |
| template<typename FuncTy> | |
| void | setHandler (FuncTy &&handler) |
| Set the handler to manage via RAII. | |
Protected Attributes | |
| llvm::SourceMgr & | mgr |
| The source manager that we are wrapping. | |
| raw_ostream & | os |
| The output stream to use when printing diagnostics. | |
| ShouldShowLocFn | shouldShowLocFn |
| A functor used when determining if a location for a diagnostic should be shown. | |
This class is a utility diagnostic handler for use with llvm::SourceMgr.
Definition at line 561 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 570 of file Diagnostics.h.
| SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler | ( | llvm::SourceMgr & | mgr, |
| MLIRContext * | ctx, | ||
| raw_ostream & | os, | ||
| ShouldShowLocFn && | shouldShowLocFn = {} ) |
Definition at line 429 of file Diagnostics.cpp.
References diag(), emitDiagnostic(), mgr, os, mlir::ScopedDiagnosticHandler::ScopedDiagnosticHandler(), mlir::ScopedDiagnosticHandler::setHandler(), and shouldShowLocFn.
Referenced by SourceMgrDiagnosticHandler(), and mlir::SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler().
| SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler | ( | llvm::SourceMgr & | mgr, |
| MLIRContext * | ctx, | ||
| ShouldShowLocFn && | shouldShowLocFn = {} ) |
Definition at line 438 of file Diagnostics.cpp.
References mgr, shouldShowLocFn, and SourceMgrDiagnosticHandler().
|
default |
References diag().
|
protected |
Emit the given diagnostic with the held source manager.
Definition at line 481 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 445 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 532 of file Diagnostics.cpp.
References mgr.
Set the maximum depth that a call stack will be printed. Defaults to 10.
Definition at line 526 of file Diagnostics.cpp.
|
protected |
The source manager that we are wrapping.
Definition at line 595 of file Diagnostics.h.
Referenced by emitDiagnostic(), getBufferForFile(), SourceMgrDiagnosticHandler(), SourceMgrDiagnosticHandler(), mlir::SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(), and mlir::SourceMgrDiagnosticVerifierHandler::verify().
|
protected |
The output stream to use when printing diagnostics.
Definition at line 598 of file Diagnostics.h.
Referenced by emitDiagnostic(), SourceMgrDiagnosticHandler(), 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 602 of file Diagnostics.h.
Referenced by SourceMgrDiagnosticHandler(), and SourceMgrDiagnosticHandler().