|
MLIR 24.0.0git
|
This class is a utility diagnostic handler for use with llvm::SourceMgr that verifies that emitted diagnostics match 'expected-*' lines on the corresponding line of the source file. More...
#include "mlir/IR/Diagnostics.h"
Public Types | |
| enum class | Level { None = 0 , All , OnlyExpected } |
| Public Types inherited from mlir::SourceMgrDiagnosticHandler | |
| using | ShouldShowLocFn = llvm::unique_function<bool(Location)> |
| This type represents a functor used to filter out locations when printing a diagnostic. | |
Public Member Functions | |
| SourceMgrDiagnosticVerifierHandler (llvm::SourceMgr &srcMgr, MLIRContext *ctx, raw_ostream &out, Level level=Level::All) | |
| SourceMgrDiagnosticVerifierHandler (llvm::SourceMgr &srcMgr, MLIRContext *ctx, Level level=Level::All) | |
| ~SourceMgrDiagnosticVerifierHandler () | |
| LogicalResult | verify () |
| Returns the status of the handler and verifies that all expected diagnostics were emitted. | |
| std::unique_ptr< ScopedDiagnosticHandler > | registerInContext (MLIRContext *ctx) |
| Register this handler with ctx and return a scoped registration. | |
| Public Member Functions inherited from mlir::SourceMgrDiagnosticHandler | |
| 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 () | |
Additional Inherited Members | |
| Protected Member Functions inherited from mlir::SourceMgrDiagnosticHandler | |
| 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 inherited from mlir::SourceMgrDiagnosticHandler | |
| 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 that verifies that emitted diagnostics match 'expected-*' lines on the corresponding line of the source file.
Definition at line 687 of file Diagnostics.h.
|
strong |
| Enumerator | |
|---|---|
| None | |
| All | |
| OnlyExpected | |
Definition at line 689 of file Diagnostics.h.
| SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler | ( | llvm::SourceMgr & | srcMgr, |
| MLIRContext * | ctx, | ||
| raw_ostream & | out, | ||
| Level | level = Level::All ) |
Definition at line 676 of file Diagnostics.cpp.
References mlir::SourceMgrDiagnosticHandler::mgr, mlir::ScopedDiagnosticHandler::setHandler(), and mlir::SourceMgrDiagnosticHandler::SourceMgrDiagnosticHandler().
Referenced by SourceMgrDiagnosticVerifierHandler().
| SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler | ( | llvm::SourceMgr & | srcMgr, |
| MLIRContext * | ctx, | ||
| Level | level = Level::All ) |
Definition at line 692 of file Diagnostics.cpp.
References SourceMgrDiagnosticVerifierHandler().
| SourceMgrDiagnosticVerifierHandler::~SourceMgrDiagnosticVerifierHandler | ( | ) |
Definition at line 696 of file Diagnostics.cpp.
References verify().
|
nodiscard |
Register this handler with ctx and return a scoped registration.
Destroy the returned handle before either this handler or ctx.
Definition at line 709 of file Diagnostics.cpp.
| LogicalResult SourceMgrDiagnosticVerifierHandler::verify | ( | ) |
Returns the status of the handler and verifies that all expected diagnostics were emitted.
Returns the status of the verifier and verifies that all expected diagnostics were emitted.
This return success if all diagnostics were verified correctly, failure otherwise.
Definition at line 704 of file Diagnostics.cpp.
References mlir::SourceMgrDiagnosticHandler::mgr, mlir::SourceMgrDiagnosticHandler::os, and success().
Referenced by mlirTranslateMainImpl(), and ~SourceMgrDiagnosticVerifierHandler().