Fix GCC build problem with 288f05f related to SmallVector. (#116958)
[llvm-project.git] / mlir / examples / standalone / python / StandaloneExtension.cpp
blob5e83060cd48d826d52434d96d0d1d8368c7c3a39
1 //===- StandaloneExtension.cpp - Extension module -------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "Standalone-c/Dialects.h"
10 #include "mlir/Bindings/Python/PybindAdaptors.h"
12 using namespace mlir::python::adaptors;
14 PYBIND11_MODULE(_standaloneDialects, m) {
15 //===--------------------------------------------------------------------===//
16 // standalone dialect
17 //===--------------------------------------------------------------------===//
18 auto standaloneM = m.def_submodule("standalone");
20 standaloneM.def(
21 "register_dialect",
22 [](MlirContext context, bool load) {
23 MlirDialectHandle handle = mlirGetDialectHandle__standalone__();
24 mlirDialectHandleRegisterDialect(handle, context);
25 if (load) {
26 mlirDialectHandleLoadDialect(handle, context);
29 py::arg("context") = py::none(), py::arg("load") = true);