MLIR  19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::python::PyLocation Class Reference

Wrapper around an MlirLocation. More...

#include "Bindings/Python/IRModule.h"

+ Inheritance diagram for mlir::python::PyLocation:

Public Member Functions

 PyLocation (PyMlirContextRef contextRef, MlirLocation loc)
 
 operator MlirLocation () const
 
MlirLocation get () const
 
pybind11::object contextEnter ()
 Enter and exit the context manager. More...
 
void contextExit (const pybind11::object &excType, const pybind11::object &excVal, const pybind11::object &excTb)
 
pybind11::object getCapsule ()
 Gets a capsule wrapping the void* within the MlirLocation. More...
 
- Public Member Functions inherited from mlir::python::BaseContextObject
 BaseContextObject (PyMlirContextRef ref)
 
PyMlirContextRefgetContext ()
 Accesses the context reference. More...
 

Static Public Member Functions

static PyLocation createFromCapsule (pybind11::object capsule)
 Creates a PyLocation from the MlirLocation wrapped by a capsule. More...
 

Detailed Description

Wrapper around an MlirLocation.

Definition at line 310 of file IRModule.h.

Constructor & Destructor Documentation

◆ PyLocation()

mlir::python::PyLocation::PyLocation ( PyMlirContextRef  contextRef,
MlirLocation  loc 
)
inline

Definition at line 312 of file IRModule.h.

Referenced by createFromCapsule().

Member Function Documentation

◆ contextEnter()

py::object PyLocation::contextEnter ( )

Enter and exit the context manager.

Definition at line 1030 of file IRCore.cpp.

References mlir::python::PyThreadContextEntry::pushLocation().

◆ contextExit()

void PyLocation::contextExit ( const pybind11::object &  excType,
const pybind11::object &  excVal,
const pybind11::object &  excTb 
)

Definition at line 1034 of file IRCore.cpp.

References mlir::python::PyThreadContextEntry::popLocation().

◆ createFromCapsule()

PyLocation PyLocation::createFromCapsule ( pybind11::object  capsule)
static

Creates a PyLocation from the MlirLocation wrapped by a capsule.

Note that PyLocation instances are uniqued, so the returned object may be a pre-existing object. Ownership of the underlying MlirLocation is taken by calling this function.

Definition at line 1022 of file IRCore.cpp.

References mlir::python::PyMlirContext::forContext(), mlirLocationGetContext(), mlirLocationIsNull(), mlirPythonCapsuleToLocation(), and PyLocation().

◆ get()

MlirLocation mlir::python::PyLocation::get ( ) const
inline

Definition at line 316 of file IRModule.h.

◆ getCapsule()

py::object PyLocation::getCapsule ( )

Gets a capsule wrapping the void* within the MlirLocation.

Definition at line 1018 of file IRCore.cpp.

References mlirPythonLocationToCapsule().

◆ operator MlirLocation()

mlir::python::PyLocation::operator MlirLocation ( ) const
inline

Definition at line 315 of file IRModule.h.


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