[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
Tue Jun 2 00:57:36 PDT 2026
================
@@ -495,6 +507,78 @@ void MoveChecker::checkPostCall(const CallEvent &Call,
assert(!C.isDifferent() && "Should not have made transitions on this path!");
}
+bool MoveChecker::evalCall(const CallEvent &Call, CheckerContext &C) const {
+
+ const auto *CE = dyn_cast_if_present<CallExpr>(Call.getOriginExpr());
+ if (!CE)
+ return false;
+
+ ProgramStateRef State = C.getState();
+
+ if (!StdMoveCall.matches(Call))
+ return false;
+
+ const auto *BeginCall =
----------------
benedekaibas wrote:
I think it should be an easy fix that I can apply. I looked up and I think I can use https://clang.llvm.org/doxygen/structclang_1_1ento_1_1iterator_1_1IteratorPosition.html#a7f1c42286e5fcefa10be383e22fe636a to recover the source of the container and use that information instead of AST pattern matching. In case it is harder for me to imlpement than I thought I will just leave a `FIXME` there and come back to it once I have more knowledge.
https://github.com/llvm/llvm-project/pull/196602
More information about the cfe-commits
mailing list