[clang-tools-extra] [clang-tidy] Improve performance-use-std-move in presence of control-flow (PR #184136)

via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 8 01:59:38 PST 2026


================
@@ -93,14 +100,43 @@ void UseStdMoveCheck::check(const MatchFinder::MatchResult &Result) {
   if (!TheCFG)
     return;
 
-  // Walk the CFG bottom-up, starting with the exit node.
-  // TODO: traverse the whole CFG instead of only considering terminator
-  // nodes.
+  // The algorithm to look for a convertible move-assign operator is the
+  // following: each node starts in the `Ready` state, with a number of
+  // `RemainingSuccessors` equal to its number of successors.
+  //
+  // Starting from the exit node, we walk the CFG backward. Whenever
+  // we meet a new block, we check if it either:
+  // 1. touches the `AssignValue`, in which case we stop the search, and mark
+  // each
----------------
zeyi2 wrote:

Nit: could you please reformat it?
```suggestion
  // each predecessor as not `Ready`. No predecessor walk.
```

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


More information about the cfe-commits mailing list