[llvm] [TableGen] Use std::move instead of swap. NFC. (PR #81606)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 05:52:58 PST 2024


================
@@ -545,8 +545,8 @@ void GroupMatcher::optimize() {
     if (T != E)
       F = ++T;
   }
-  optimizeRules<GroupMatcher>(Matchers, MatcherStorage).swap(Matchers);
-  optimizeRules<SwitchMatcher>(Matchers, MatcherStorage).swap(Matchers);
+  Matchers = optimizeRules<GroupMatcher>(Matchers, MatcherStorage);
+  Matchers = optimizeRules<SwitchMatcher>(Matchers, MatcherStorage);
----------------
jayfoad wrote:

No `std::move`s here since we would be moving from a temporary, and the compiler warns that this prevents copy elision.

https://github.com/llvm/llvm-project/pull/81606


More information about the llvm-commits mailing list