[llvm-branch-commits] [mlir] ac6ada4 - Fix MLIR Python bindings build after changes to the C API to use StringRef (NFC)

Mehdi Amini via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 8 19:31:50 PST 2020


Author: Mehdi Amini
Date: 2020-12-09T03:27:37Z
New Revision: ac6ada4d3e059397d2812c8c0bd449214bc58737

URL: https://github.com/llvm/llvm-project/commit/ac6ada4d3e059397d2812c8c0bd449214bc58737
DIFF: https://github.com/llvm/llvm-project/commit/ac6ada4d3e059397d2812c8c0bd449214bc58737.diff

LOG: Fix MLIR Python bindings build after changes to the C API to use StringRef (NFC)

Added: 
    

Modified: 
    mlir/lib/Bindings/Python/IRModules.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bindings/Python/IRModules.cpp b/mlir/lib/Bindings/Python/IRModules.cpp
index cffebf6c715c..5519c66ee1ab 100644
--- a/mlir/lib/Bindings/Python/IRModules.cpp
+++ b/mlir/lib/Bindings/Python/IRModules.cpp
@@ -1571,7 +1571,7 @@ class PyStringAttribute : public PyConcreteAttribute<PyStringAttribute> {
         "get",
         [](std::string value, DefaultingPyMlirContext context) {
           MlirAttribute attr =
-              mlirStringAttrGet(context->get(), value.size(), &value[0]);
+              mlirStringAttrGet(context->get(), toMlirStringRef(value));
           return PyStringAttribute(context->getRef(), attr);
         },
         py::arg("value"), py::arg("context") = py::none(),
@@ -1580,7 +1580,7 @@ class PyStringAttribute : public PyConcreteAttribute<PyStringAttribute> {
         "get_typed",
         [](PyType &type, std::string value) {
           MlirAttribute attr =
-              mlirStringAttrTypedGet(type, value.size(), &value[0]);
+              mlirStringAttrTypedGet(type, toMlirStringRef(value));
           return PyStringAttribute(type.getContext(), attr);
         },
 


        


More information about the llvm-branch-commits mailing list