@@ -47,6 +47,9 @@ static const char kContextGetCallSiteLocationDocstring[] =
47
47
static const char kContextGetFileLocationDocstring [] =
48
48
R"( Gets a Location representing a file, line and column)" ;
49
49
50
+ static const char kContextGetFusedLocationDocstring [] =
51
+ R"( Gets a Location representing a fused location with optional metadata)" ;
52
+
50
53
static const char kContextGetNameLocationDocString [] =
51
54
R"( Gets a Location representing a named location with optional child location)" ;
52
55
@@ -2197,6 +2200,23 @@ void mlir::python::populateIRCore(py::module &m) {
2197
2200
},
2198
2201
py::arg (" filename" ), py::arg (" line" ), py::arg (" col" ),
2199
2202
py::arg (" context" ) = py::none (), kContextGetFileLocationDocstring )
2203
+ .def_static (
2204
+ " fused" ,
2205
+ [](const std::vector<PyLocation> &pyLocations, llvm::Optional<PyAttribute> metadata,
2206
+ DefaultingPyMlirContext context) {
2207
+ if (pyLocations.empty ())
2208
+ throw py::value_error (" No locations provided" );
2209
+ llvm::SmallVector<MlirLocation, 4 > locations;
2210
+ locations.reserve (pyLocations.size ());
2211
+ for (auto &pyLocation : pyLocations)
2212
+ locations.push_back (pyLocation.get ());
2213
+ MlirLocation location = mlirLocationFusedGet (
2214
+ context->get (), locations.size (), locations.data (),
2215
+ metadata ? metadata->get () : MlirAttribute{0 });
2216
+ return PyLocation (context->getRef (), location);
2217
+ },
2218
+ py::arg (" locations" ), py::arg (" metadata" ) = py::none (),
2219
+ py::arg (" context" ) = py::none (), kContextGetFusedLocationDocstring )
2200
2220
.def_static (
2201
2221
" name" ,
2202
2222
[](std::string name, llvm::Optional<PyLocation> childLoc,
0 commit comments