Lines Matching full:call

45     : public Checker<eval::Call, check::DeadSymbols, check::RegionChanges,
48 bool isBoolConversionMethod(const CallEvent &Call) const;
53 bool evalCall(const CallEvent &Call, CheckerContext &C) const;
60 const LocationContext *LCtx, const CallEvent *Call) const;
66 void handleReset(const CallEvent &Call, CheckerContext &C) const;
67 void handleRelease(const CallEvent &Call, CheckerContext &C) const;
68 void handleSwapMethod(const CallEvent &Call, CheckerContext &C) const;
69 void handleGet(const CallEvent &Call, CheckerContext &C) const;
70 bool handleAssignOp(const CallEvent &Call, CheckerContext &C) const;
71 bool handleMoveCtr(const CallEvent &Call, CheckerContext &C,
75 const CallEvent &Call) const;
76 void handleBoolConversion(const CallEvent &Call, CheckerContext &C) const;
77 bool handleComparisionOp(const CallEvent &Call, CheckerContext &C) const;
78 bool handleOstreamOperator(const CallEvent &Call, CheckerContext &C) const;
87 void (SmartPtrModeling::*)(const CallEvent &Call, CheckerContext &) const;
127 bool isStdSmartPtrCall(const CallEvent &Call) { in isStdSmartPtrCall() argument
128 const auto *MethodDecl = dyn_cast_or_null<CXXMethodDecl>(Call.getDecl()); in isStdSmartPtrCall()
201 static QualType getPointerTypeFromTemplateArg(const CallEvent &Call, in getPointerTypeFromTemplateArg() argument
203 const auto *FD = dyn_cast_or_null<FunctionDecl>(Call.getDecl()); in getPointerTypeFromTemplateArg()
215 static QualType getInnerPointerType(const CallEvent &Call, CheckerContext &C) { in getInnerPointerType() argument
216 const auto *MethodDecl = dyn_cast_or_null<CXXMethodDecl>(Call.getDecl()); in getInnerPointerType()
233 bool SmartPtrModeling::isBoolConversionMethod(const CallEvent &Call) const { in isBoolConversionMethod()
238 const auto *CD = dyn_cast_or_null<CXXConversionDecl>(Call.getDecl()); in isBoolConversionMethod()
249 static bool isStdFunctionCall(const CallEvent &Call) { in isStdFunctionCall() argument
250 return Call.getDecl() && Call.getDecl()->getDeclContext()->isStdNamespace(); in isStdFunctionCall()
253 bool isStdOstreamOperatorCall(const CallEvent &Call) { in isStdOstreamOperatorCall() argument
254 if (Call.getNumArgs() != 2 || !isStdFunctionCall(Call)) in isStdOstreamOperatorCall()
256 const auto *FC = dyn_cast<SimpleFunctionCall>(&Call); in isStdOstreamOperatorCall()
265 return isStdSmartPtr(Call.getArgExpr(1)) && in isStdOstreamOperatorCall()
266 isStdBasicOstream(Call.getArgExpr(0)); in isStdOstreamOperatorCall()
269 static bool isPotentiallyComparisionOpCall(const CallEvent &Call) { in isPotentiallyComparisionOpCall() argument
270 if (Call.getNumArgs() != 2 || !isStdFunctionCall(Call)) in isPotentiallyComparisionOpCall()
272 return smartptr::isStdSmartPtr(Call.getArgExpr(0)) || in isPotentiallyComparisionOpCall()
273 smartptr::isStdSmartPtr(Call.getArgExpr(1)); in isPotentiallyComparisionOpCall()
276 bool SmartPtrModeling::evalCall(const CallEvent &Call, in evalCall() argument
283 if (ModelSmartPtrDereference && isPotentiallyComparisionOpCall(Call)) in evalCall()
284 if (handleComparisionOp(Call, C)) in evalCall()
287 if (ModelSmartPtrDereference && isStdOstreamOperatorCall(Call)) in evalCall()
288 return handleOstreamOperator(Call, C); in evalCall()
290 if (StdSwapCall.matches(Call)) { in evalCall()
292 assert(Call.getNumArgs() == 2 && "std::swap should have two arguments"); in evalCall()
293 const Expr *FirstArg = Call.getArgExpr(0); in evalCall()
296 return handleSwap(State, Call.getArgSVal(0), Call.getArgSVal(1), C); in evalCall()
299 if (MakeUniqueVariants.contains(Call)) { in evalCall()
304 Call.getReturnValueUnderConstruction(); in evalCall()
309 Call.getOriginExpr(), C.getLocationContext(), in evalCall()
310 getPointerTypeFromTemplateArg(Call, C), C.blockCount()); in evalCall()
330 // function call (constructors obviously construct, hence can be in evalCall()
335 Call.getConstructionContext(), {}); in evalCall()
338 // unique_ptr from this call is non-null (hence is safe to de-reference). in evalCall()
343 if (!smartptr::isStdSmartPtrCall(Call)) in evalCall()
346 if (isBoolConversionMethod(Call)) { in evalCall()
348 cast<CXXInstanceCall>(&Call)->getCXXThisVal().getAsRegion(); in evalCall()
355 handleBoolConversion(Call, C); in evalCall()
366 Call.getOriginExpr(), C.getLocationContext(), in evalCall()
367 C.getSValBuilder().makeZeroVal(Call.getResultType()))); in evalCall()
376 if (const auto *CC = dyn_cast<CXXConstructorCall>(&Call)) { in evalCall()
384 QualType ThisType = cast<CXXMethodDecl>(Call.getDecl())->getThisType(); in evalCall()
387 return handleMoveCtr(Call, C, ThisRegion); in evalCall()
389 if (Call.getNumArgs() == 0) { in evalCall()
404 const auto *TrackingExpr = Call.getArgExpr(0); in evalCall()
407 auto ArgVal = Call.getArgSVal(0); in evalCall()
428 if (handleAssignOp(Call, C)) in evalCall()
431 const SmartPtrMethodHandlerFn *Handler = SmartPtrMethodHandlers.lookup(Call); in evalCall()
434 (this->**Handler)(Call, C); in evalCall()
451 bool SmartPtrModeling::handleComparisionOp(const CallEvent &Call, in handleComparisionOp() argument
453 const auto *FC = dyn_cast<SimpleFunctionCall>(&Call); in handleComparisionOp()
483 SVal First = Call.getArgSVal(0); in handleComparisionOp()
484 SVal Second = Call.getArgSVal(1); in handleComparisionOp()
485 const auto *FirstExpr = Call.getArgExpr(0); in handleComparisionOp()
486 const auto *SecondExpr = Call.getArgExpr(1); in handleComparisionOp()
488 const auto *ResultExpr = Call.getOriginExpr(); in handleComparisionOp()
499 Call.getResultType()); in handleComparisionOp()
517 bool SmartPtrModeling::handleOstreamOperator(const CallEvent &Call, in handleOstreamOperator() argument
528 const auto StreamVal = Call.getArgSVal(0); in handleOstreamOperator()
533 State->invalidateRegions({StreamThisRegion}, Call.getOriginExpr(), in handleOstreamOperator()
536 State->BindExpr(Call.getOriginExpr(), C.getLocationContext(), StreamVal); in handleOstreamOperator()
577 const CallEvent *Call) const { in checkRegionChanges()
598 void SmartPtrModeling::handleReset(const CallEvent &Call, in handleReset() argument
601 const auto *IC = dyn_cast<CXXInstanceCall>(&Call); in handleReset()
609 assert(Call.getArgExpr(0)->getType()->isPointerType() && in handleReset()
611 State = State->set<TrackedRegionMap>(ThisRegion, Call.getArgSVal(0)); in handleReset()
612 const auto *TrackingExpr = Call.getArgExpr(0); in handleReset()
628 void SmartPtrModeling::handleRelease(const CallEvent &Call, in handleRelease() argument
631 const auto *IC = dyn_cast<CXXInstanceCall>(&Call); in handleRelease()
642 State = State->BindExpr(Call.getOriginExpr(), C.getLocationContext(), in handleRelease()
646 QualType ThisType = cast<CXXMethodDecl>(Call.getDecl())->getThisType(); in handleRelease()
664 void SmartPtrModeling::handleSwapMethod(const CallEvent &Call, in handleSwapMethod() argument
667 const auto *IC = dyn_cast<CXXInstanceCall>(&Call); in handleSwapMethod()
672 handleSwap(State, IC->getCXXThisVal(), Call.getArgSVal(0), C); in handleSwapMethod()
712 void SmartPtrModeling::handleGet(const CallEvent &Call, in handleGet() argument
715 const auto *IC = dyn_cast<CXXInstanceCall>(&Call); in handleGet()
725 State, ThisRegion, Call.getOriginExpr(), Call.getResultType(), C); in handleGet()
726 State = State->BindExpr(Call.getOriginExpr(), C.getLocationContext(), in handleGet()
732 bool SmartPtrModeling::handleAssignOp(const CallEvent &Call, in handleAssignOp() argument
735 const auto *OC = dyn_cast<CXXMemberOperatorCall>(&Call); in handleAssignOp()
745 QualType ThisType = cast<CXXMethodDecl>(Call.getDecl())->getThisType(); in handleAssignOp()
750 bool AssignedNull = Call.getArgSVal(0).isZeroConstant(); in handleAssignOp()
767 return updateMovedSmartPointers(C, ThisRegion, OtherSmartPtrRegion, Call); in handleAssignOp()
770 bool SmartPtrModeling::handleMoveCtr(const CallEvent &Call, CheckerContext &C, in handleMoveCtr() argument
772 const auto *OtherSmartPtrRegion = Call.getArgSVal(0).getAsRegion(); in handleMoveCtr()
776 return updateMovedSmartPointers(C, ThisRegion, OtherSmartPtrRegion, Call); in handleMoveCtr()
781 const MemRegion *OtherSmartPtrRegion, const CallEvent &Call) const { in updateMovedSmartPointers()
783 QualType ThisType = cast<CXXMethodDecl>(Call.getDecl())->getThisType(); in updateMovedSmartPointers()
834 void SmartPtrModeling::handleBoolConversion(const CallEvent &Call, in handleBoolConversion() argument
838 const Expr *CallExpr = Call.getOriginExpr(); in handleBoolConversion()
840 cast<CXXInstanceCall>(&Call)->getCXXThisVal().getAsRegion(); in handleBoolConversion()
842 QualType ThisType = cast<CXXMethodDecl>(Call.getDecl())->getThisType(); in handleBoolConversion()
850 auto InnerPointerType = getInnerPointerType(Call, C); in handleBoolConversion()
875 C.getSValBuilder().makeZeroVal(Call.getResultType()))); in handleBoolConversion()