@@ -741,15 +741,26 @@ static void transferPointerToBoolean(const ImplicitCastExpr *Expr,
741741 dyn_cast_or_null<BoolValue>(State.Env .getValue (*Expr->getSubExpr ())))
742742 State.Env .setValue (*Expr, *SubExprVal);
743743}
744- static void handleConstStatusOrAccessorMemberCall (
744+
745+ static void transferStatusOrReturningCall (const CallExpr *Expr,
746+ LatticeTransferState &State) {
747+ RecordStorageLocation *StatusOrLoc =
748+ Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
749+ : State.Env .get <RecordStorageLocation>(*Expr);
750+ if (StatusOrLoc != nullptr &&
751+ State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
752+ initializeStatusOr (*StatusOrLoc, State.Env );
753+ }
754+
755+ static bool doHandleConstStatusOrAccessorMemberCall (
745756 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
746757 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
747758 assert (isStatusOrType (Expr->getType ()));
748759 if (RecordLoc == nullptr )
749- return ;
760+ return false ;
750761 const FunctionDecl *DirectCallee = Expr->getDirectCallee ();
751762 if (DirectCallee == nullptr )
752- return ;
763+ return false ;
753764 StorageLocation &Loc =
754765 State.Lattice .getOrCreateConstMethodReturnStorageLocation (
755766 *RecordLoc, DirectCallee, State.Env , [&](StorageLocation &Loc) {
@@ -761,8 +772,15 @@ static void handleConstStatusOrAccessorMemberCall(
761772 } else {
762773 State.Env .setStorageLocation (*Expr, Loc);
763774 }
775+ return true ;
764776}
765777
778+ static void handleConstStatusOrAccessorMemberCall (
779+ const CallExpr *Expr, RecordStorageLocation *RecordLoc,
780+ const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
781+ if (!doHandleConstStatusOrAccessorMemberCall (Expr, RecordLoc, Result, State))
782+ transferStatusOrReturningCall (Expr, State);
783+ }
766784static void handleConstStatusOrPointerAccessorMemberCall (
767785 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
768786 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
@@ -804,16 +822,6 @@ static void transferConstStatusOrPointerAccessorMemberOperatorCall(
804822 handleConstStatusOrPointerAccessorMemberCall (Expr, RecordLoc, Result, State);
805823}
806824
807- static void transferStatusOrReturningCall (const CallExpr *Expr,
808- LatticeTransferState &State) {
809- RecordStorageLocation *StatusOrLoc =
810- Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
811- : State.Env .get <RecordStorageLocation>(*Expr);
812- if (StatusOrLoc != nullptr &&
813- State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
814- initializeStatusOr (*StatusOrLoc, State.Env );
815- }
816-
817825static void handleNonConstMemberCall (const CallExpr *Expr,
818826 RecordStorageLocation *RecordLoc,
819827 const MatchFinder::MatchResult &Result,
0 commit comments