[clang] [clang][analyzer] Detect use-after-move for 3-arg std::move (PR #196602)

Benedek Kaibas via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 7 14:25:36 PDT 2026


================
@@ -1015,3 +1015,22 @@ struct OtherMoveSafeClasses {
     // aggressive-note at -2   {{Moved-from object 'Task' is moved}}
   }
 };
+
+void safeOperatorAfterMove() {
+  std::list<std::string> l1;
+  l1.push_back("l1");
+  std::list<std::string> l2;
----------------
benedekaibas wrote:

I have used a template function for the negative use-after-move cases. I have only done it for those since the reporting line is the same for all of them. For the positive cases since the reporting lines aren't the same I kept the previous test cases. For the positive test cases I think marking the reporting lines separately is more important than reducing repeated code patterns, so I have kept the old behavior.

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


More information about the cfe-commits mailing list