Fix clang-tidy warnings in MLIR Python bindings (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Tue, 19 Oct 2021 17:13:54 +0000 (17:13 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Tue, 19 Oct 2021 17:15:20 +0000 (17:15 +0000)
mlir/lib/Bindings/Python/IRAffine.cpp
mlir/lib/Bindings/Python/IRCore.cpp

index 0027b68..50a96c8 100644 (file)
@@ -555,6 +555,7 @@ void mlir::python::populateIRAffine(py::module &m) {
                     mlirAffineMapCompressUnusedSymbols(
                         maps.data(), maps.size(), compressed.data(), populate);
                     std::vector<PyAffineMap> res;
+                    res.reserve(compressed.size());
                     for (auto m : compressed)
                       res.push_back(PyAffineMap(context->getRef(), m));
                     return res;
index ed96baf..4fc581b 100644 (file)
@@ -1976,7 +1976,7 @@ void mlir::python::populateIRCore(py::module &m) {
             if (frames.empty())
               throw py::value_error("No caller frames provided");
             MlirLocation caller = frames.back().get();
-            for (PyLocation frame :
+            for (const PyLocation &frame :
                  llvm::reverse(llvm::makeArrayRef(frames).drop_back()))
               caller = mlirLocationCallSiteGet(frame.get(), caller);
             return PyLocation(context->getRef(),