My Project
Public Types | Public Member Functions | Friends | List of all members
mlir::DiagnosticEngine Class Reference

#include <Diagnostics.h>

Public Types

using HandlerTy = std::function< LogicalResult(Diagnostic &)>
 
using HandlerID = uint64_t
 A handle to a specific registered handler object. More...
 

Public Member Functions

 ~DiagnosticEngine ()
 
HandlerID registerHandler (const HandlerTy &handler)
 
template<typename FuncTy , typename RetT = decltype(std::declval<FuncTy>()( std::declval<Diagnostic &>()))>
std::enable_if_t< std::is_same< RetT, void >::value, HandlerIDregisterHandler (FuncTy &&handler)
 
void eraseHandler (HandlerID id)
 Erase the registered diagnostic handler with the given identifier. More...
 
InFlightDiagnostic emit (Location loc, DiagnosticSeverity severity)
 Create a new inflight diagnostic with the given location and severity. More...
 
void emit (Diagnostic diag)
 

Friends

class MLIRContextImpl
 

Detailed Description

This class is the main interface for diagnostics. The DiagnosticEngine manages the registration of diagnostic handlers as well as the core API for diagnostic emission. This class should not be constructed directly, but instead interfaced with via an MLIRContext instance.

Member Typedef Documentation

◆ HandlerID

A handle to a specific registered handler object.

◆ HandlerTy

The handler type for MLIR diagnostics. This function takes a diagnostic as input, and returns success if the handler has fully processed this diagnostic. Returns failure otherwise.

Constructor & Destructor Documentation

◆ ~DiagnosticEngine()

DiagnosticEngine::~DiagnosticEngine ( )

Member Function Documentation

◆ emit() [1/2]

InFlightDiagnostic mlir::DiagnosticEngine::emit ( Location  loc,
DiagnosticSeverity  severity 
)
inline

Create a new inflight diagnostic with the given location and severity.

◆ emit() [2/2]

void DiagnosticEngine::emit ( Diagnostic  diag)

Emit a diagnostic using the registered issue handler if present, or with the default behavior if not.

◆ eraseHandler()

void DiagnosticEngine::eraseHandler ( HandlerID  id)

Erase the registered diagnostic handler with the given identifier.

◆ registerHandler() [1/2]

auto DiagnosticEngine::registerHandler ( const HandlerTy handler)

Register a new handler for diagnostics to the engine. Diagnostics are process by handlers in stack-like order, meaning that the last added handlers will process diagnostics first. This function returns a unique identifier for the registered handler, which can be used to unregister this handler at a later time.

Register a new handler for diagnostics to the engine. This function returns a unique identifier for the registered handler, which can be used to unregister this handler at a later time.

◆ registerHandler() [2/2]

template<typename FuncTy , typename RetT = decltype(std::declval<FuncTy>()( std::declval<Diagnostic &>()))>
std::enable_if_t<std::is_same<RetT, void>::value, HandlerID> mlir::DiagnosticEngine::registerHandler ( FuncTy &&  handler)
inline

Set the diagnostic handler with a function that returns void. This is a convenient wrapper for handlers that always completely process the given diagnostic.

Friends And Related Function Documentation

◆ MLIRContextImpl

friend class MLIRContextImpl
friend

The documentation for this class was generated from the following files: