From 91e6816830bd874deec29baac7076086500217b2 Mon Sep 17 00:00:00 2001 From: Nico Reissmann Date: Sat, 21 Dec 2024 11:53:55 +0100 Subject: [PATCH] Add bugprone-move-forwarding-reference check to clang-tidy --- .clang-tidy | 2 ++ jlm/rvsdg/reduction-helpers.hpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index dd474def7..7e13dc7ae 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,10 +1,12 @@ --- Checks: '-*, + bugprone-move-forwarding-reference, modernize-deprecated-headers, modernize-redundant-void-arg, ' WarningsAsErrors: ' + bugprone-move-forwarding-reference, modernize-deprecated-headers, modernize-redundant-void-arg, ' \ No newline at end of file diff --git a/jlm/rvsdg/reduction-helpers.hpp b/jlm/rvsdg/reduction-helpers.hpp index 5cdd31be0..8680bf46f 100644 --- a/jlm/rvsdg/reduction-helpers.hpp +++ b/jlm/rvsdg/reduction-helpers.hpp @@ -52,7 +52,7 @@ pairwise_reduce(Container && args, const Reductor & reductor) { if (args.empty()) { - return std::move(args); + return std::forward(args); } auto left = args.begin(); @@ -75,7 +75,7 @@ pairwise_reduce(Container && args, const Reductor & reductor) } args.erase(std::next(left), args.end()); - return std::move(args); + return std::forward(args); } /* Test whether any pair of elements of "args" can be reduced according @@ -137,7 +137,7 @@ commutative_pairwise_reduce(Container && args, const Reductor & reductor) ++left; } - return std::move(args); + return std::forward(args); } /* Test whether "flatten_tester" applies to any element of "args". */