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);
         },
 


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to