[Mlir-commits] [mlir] a8b4616 - [mlir] Apply ClangTidy BugProne fix

Adrian Kuegel llvmlistbot at llvm.org
Thu Apr 11 03:26:42 PDT 2024


Author: Adrian Kuegel
Date: 2024-04-11T10:25:53Z
New Revision: a8b461603b3fab3b229ea6552433cb359c30350c

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

LOG: [mlir] Apply ClangTidy BugProne fix

forwarding reference passed to std::move(), which may unexpectedly cause
lvalues to be moved; use std::forward() instead.

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/DialectConversion.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 8671c1008902a0..f4e34a03d3d09a 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -757,7 +757,7 @@ class UnresolvedMaterializationRewrite : public OperationRewrite {
 /// rewrite type and operation among the given rewrites.
 template <typename RewriteTy, typename R>
 static bool hasRewrite(R &&rewrites, Operation *op) {
-  return any_of(std::move(rewrites), [&](auto &rewrite) {
+  return any_of(std::forward(rewrites), [&](auto &rewrite) {
     auto *rewriteTy = dyn_cast<RewriteTy>(rewrite.get());
     return rewriteTy && rewriteTy->getOperation() == op;
   });


        


More information about the Mlir-commits mailing list