MLIR  16.0.0git
Functions
Diagnostics.cpp File Reference
#include "mlir-c/Diagnostics.h"
#include "mlir/CAPI/Diagnostics.h"
#include "mlir/CAPI/IR.h"
#include "mlir/CAPI/Support.h"
#include "mlir/CAPI/Utils.h"
#include "mlir/IR/Diagnostics.h"
+ Include dependency graph for Diagnostics.cpp:

Go to the source code of this file.

Functions

void mlirDiagnosticPrint (MlirDiagnostic diagnostic, MlirStringCallback callback, void *userData)
 Prints a diagnostic using the provided callback. More...
 
MlirLocation mlirDiagnosticGetLocation (MlirDiagnostic diagnostic)
 Returns the location at which the diagnostic is reported. More...
 
MlirDiagnosticSeverity mlirDiagnosticGetSeverity (MlirDiagnostic diagnostic)
 Returns the severity of the diagnostic. More...
 
intptr_t mlirDiagnosticGetNumNotes (MlirDiagnostic diagnostic)
 Returns the number of notes attached to the diagnostic. More...
 
MlirDiagnostic mlirDiagnosticGetNote (MlirDiagnostic diagnostic, intptr_t pos)
 Returns pos-th note attached to the diagnostic. More...
 
static void deleteUserDataNoop (void *userData)
 
MlirDiagnosticHandlerID mlirContextAttachDiagnosticHandler (MlirContext context, MlirDiagnosticHandler handler, void *userData, void(*deleteUserData)(void *))
 Attaches the diagnostic handler to the context. More...
 
void mlirContextDetachDiagnosticHandler (MlirContext context, MlirDiagnosticHandlerID id)
 Detaches an attached diagnostic handler from the context given its identifier. More...
 
void mlirEmitError (MlirLocation location, const char *message)
 Emits an error at the given location through the diagnostics engine. More...
 

Function Documentation

◆ deleteUserDataNoop()

static void deleteUserDataNoop ( void userData)
static

Definition at line 54 of file Diagnostics.cpp.

Referenced by mlirContextAttachDiagnosticHandler().

◆ mlirContextAttachDiagnosticHandler()

MlirDiagnosticHandlerID mlirContextAttachDiagnosticHandler ( MlirContext  context,
MlirDiagnosticHandler  handler,
void userData,
void(*)(void *)  deleteUserData 
)

Attaches the diagnostic handler to the context.

Handlers are invoked in the reverse order of attachment until one of them processes the diagnostic completely. When a handler is invoked it is passed the userData that was provided when it was attached. If non-NULL, deleteUserData is called once the system no longer needs to call the handler (for instance after the handler is detached or the context is destroyed). Returns an identifier that can be used to detach the handler.

Definition at line 56 of file Diagnostics.cpp.

References deleteUserDataNoop(), unwrap(), and wrap().

Referenced by mlir::python::PyMlirContext::attachDiagnosticHandler().

◆ mlirContextDetachDiagnosticHandler()

void mlirContextDetachDiagnosticHandler ( MlirContext  context,
MlirDiagnosticHandlerID  id 
)

Detaches an attached diagnostic handler from the context given its identifier.

Definition at line 72 of file Diagnostics.cpp.

References unwrap().

Referenced by mlir::python::PyDiagnosticHandler::detach().

◆ mlirDiagnosticGetLocation()

MlirLocation mlirDiagnosticGetLocation ( MlirDiagnostic  diagnostic)

Returns the location at which the diagnostic is reported.

Definition at line 24 of file Diagnostics.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyDiagnostic::getLocation().

◆ mlirDiagnosticGetNote()

MlirDiagnostic mlirDiagnosticGetNote ( MlirDiagnostic  diagnostic,
intptr_t  pos 
)

Returns pos-th note attached to the diagnostic.

Expects pos to be a valid zero-based index into the list of notes.

Definition at line 50 of file Diagnostics.cpp.

References unwrap(), and wrap().

Referenced by mlir::python::PyDiagnostic::getNotes().

◆ mlirDiagnosticGetNumNotes()

intptr_t mlirDiagnosticGetNumNotes ( MlirDiagnostic  diagnostic)

Returns the number of notes attached to the diagnostic.

Definition at line 44 of file Diagnostics.cpp.

References unwrap().

Referenced by mlir::python::PyDiagnostic::getNotes().

◆ mlirDiagnosticGetSeverity()

MlirDiagnosticSeverity mlirDiagnosticGetSeverity ( MlirDiagnostic  diagnostic)

◆ mlirDiagnosticPrint()

void mlirDiagnosticPrint ( MlirDiagnostic  diagnostic,
MlirStringCallback  callback,
void userData 
)

Prints a diagnostic using the provided callback.

Definition at line 18 of file Diagnostics.cpp.

References mlir::Diagnostic::print(), and unwrap().

Referenced by mlir::python::PyDiagnostic::getMessage().

◆ mlirEmitError()

void mlirEmitError ( MlirLocation  location,
const char *  message 
)

Emits an error at the given location through the diagnostics engine.

Used for testing purposes.

Definition at line 78 of file Diagnostics.cpp.

References mlir::emitError(), and unwrap().

Referenced by mlir::python::PySymbolTable::walkSymbolTables().