Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 70ac582

Browse files
authored
[mlir][python] add use_name_loc_as_prefix to value.get_name() (#135052)
Add `use_name_loc_as_prefix` to `value.get_name()`.
1 parent 88cf9b0 commit 70ac582

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mlir/lib/Bindings/Python/IRCore.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3977,11 +3977,13 @@ void mlir::python::populateIRCore(nb::module_ &m) {
39773977
kValueDunderStrDocstring)
39783978
.def(
39793979
"get_name",
3980-
[](PyValue &self, bool useLocalScope) {
3980+
[](PyValue &self, bool useLocalScope, bool useNameLocAsPrefix) {
39813981
PyPrintAccumulator printAccum;
39823982
MlirOpPrintingFlags flags = mlirOpPrintingFlagsCreate();
39833983
if (useLocalScope)
39843984
mlirOpPrintingFlagsUseLocalScope(flags);
3985+
if (useNameLocAsPrefix)
3986+
mlirOpPrintingFlagsPrintNameLocAsPrefix(flags);
39853987
MlirAsmState valueState =
39863988
mlirAsmStateCreateForValue(self.get(), flags);
39873989
mlirValuePrintAsOperand(self.get(), valueState,
@@ -3991,7 +3993,8 @@ void mlir::python::populateIRCore(nb::module_ &m) {
39913993
mlirAsmStateDestroy(valueState);
39923994
return printAccum.join();
39933995
},
3994-
nb::arg("use_local_scope") = false)
3996+
nb::arg("use_local_scope") = false,
3997+
nb::arg("use_name_loc_as_prefix") = false)
39953998
.def(
39963999
"get_name",
39974000
[](PyValue &self, PyAsmState &state) {

0 commit comments

Comments
 (0)