[clang] [LifetimeSafety] Track moved declarations to prevent false positives (PR #170007)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 16 10:07:22 PST 2026


================
@@ -163,9 +163,27 @@ void FactsGenerator::VisitCXXMemberCallExpr(const CXXMemberCallExpr *MCE) {
   }
 }
 
+static bool isStdMove(const FunctionDecl *FD) {
----------------
usx95 wrote:

I couldn't find a simple way to do. `std::move` like functions accept a lvalue ref and returns a rvalue ref. Functions accepting rvalue refs are already too late if we do not want to non-trivial ast-traversal of the argument to find the moved decl.

The more principled fix would be detect "origins" which are moved, e.g. to address something like `std::move(cond?a:b)`. 
Even after that, it is hard to detect `std::move` like functions.

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


More information about the cfe-commits mailing list