================
@@ -495,6 +503,49 @@ 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 =
+ dyn_cast<CXXMemberCallExpr>(CE->getArg(0)->IgnoreImpCasts());
+ if (!BeginCall)
+ return false;
+
+ const Expr *ContainerExpr = BeginCall->getImplicitObjectArgument();
+ const auto *DRE = dyn_cast<DeclRefExpr>(ContainerExpr->IgnoreImpCasts());
+ if (!DRE)
+ return false;
+
+ const auto *VD = dyn_cast<VarDecl>(DRE->getDecl());
+ if (!VD)
+ return false;
+
+ const MemRegion *Region =
+ State->getLValue(VD, C.getLocationContext()).getAsRegion();
+ if (!Region)
+ return false;
+
+ const CXXRecordDecl *RD = ContainerExpr->getType()->getAsCXXRecordDecl();
+ if (!RD)
+ return false;
+
+ ObjectKind OK = classifyObject(State, Region, RD);
+
+ if (shouldBeTracked(OK)) {
----------------
Xazax-hun wrote:
Nit: we usually don't use braces for single statement branches.
https://github.com/llvm/llvm-project/pull/196602
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits