@@ -844,15 +844,26 @@ static void transferPointerToBoolean(const ImplicitCastExpr *Expr,
844844 dyn_cast_or_null<BoolValue>(State.Env .getValue (*Expr->getSubExpr ())))
845845 State.Env .setValue (*Expr, *SubExprVal);
846846}
847- static void handleConstStatusOrAccessorMemberCall (
847+
848+ static void transferStatusOrReturningCall (const CallExpr *Expr,
849+ LatticeTransferState &State) {
850+ RecordStorageLocation *StatusOrLoc =
851+ Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
852+ : State.Env .get <RecordStorageLocation>(*Expr);
853+ if (StatusOrLoc != nullptr &&
854+ State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
855+ initializeStatusOr (*StatusOrLoc, State.Env );
856+ }
857+
858+ static bool doHandleConstStatusOrAccessorMemberCall (
848859 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
849860 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
850861 assert (isStatusOrType (Expr->getType ()));
851862 if (RecordLoc == nullptr )
852- return ;
863+ return false ;
853864 const FunctionDecl *DirectCallee = Expr->getDirectCallee ();
854865 if (DirectCallee == nullptr )
855- return ;
866+ return false ;
856867 StorageLocation &Loc =
857868 State.Lattice .getOrCreateConstMethodReturnStorageLocation (
858869 *RecordLoc, DirectCallee, State.Env , [&](StorageLocation &Loc) {
@@ -864,8 +875,15 @@ static void handleConstStatusOrAccessorMemberCall(
864875 } else {
865876 State.Env .setStorageLocation (*Expr, Loc);
866877 }
878+ return true ;
867879}
868880
881+ static void handleConstStatusOrAccessorMemberCall (
882+ const CallExpr *Expr, RecordStorageLocation *RecordLoc,
883+ const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
884+ if (!doHandleConstStatusOrAccessorMemberCall (Expr, RecordLoc, Result, State))
885+ transferStatusOrReturningCall (Expr, State);
886+ }
869887static void handleConstStatusOrPointerAccessorMemberCall (
870888 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
871889 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
@@ -907,16 +925,6 @@ static void transferConstStatusOrPointerAccessorMemberOperatorCall(
907925 handleConstStatusOrPointerAccessorMemberCall (Expr, RecordLoc, Result, State);
908926}
909927
910- static void transferStatusOrReturningCall (const CallExpr *Expr,
911- LatticeTransferState &State) {
912- RecordStorageLocation *StatusOrLoc =
913- Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
914- : State.Env .get <RecordStorageLocation>(*Expr);
915- if (StatusOrLoc != nullptr &&
916- State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
917- initializeStatusOr (*StatusOrLoc, State.Env );
918- }
919-
920928static void handleNonConstMemberCall (const CallExpr *Expr,
921929 RecordStorageLocation *RecordLoc,
922930 const MatchFinder::MatchResult &Result,
0 commit comments