@@ -740,15 +740,26 @@ static void transferPointerToBoolean(const ImplicitCastExpr *Expr,
740740 dyn_cast_or_null<BoolValue>(State.Env .getValue (*Expr->getSubExpr ())))
741741 State.Env .setValue (*Expr, *SubExprVal);
742742}
743- static void handleConstStatusOrAccessorMemberCall (
743+
744+ static void transferStatusOrReturningCall (const CallExpr *Expr,
745+ LatticeTransferState &State) {
746+ RecordStorageLocation *StatusOrLoc =
747+ Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
748+ : State.Env .get <RecordStorageLocation>(*Expr);
749+ if (StatusOrLoc != nullptr &&
750+ State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
751+ initializeStatusOr (*StatusOrLoc, State.Env );
752+ }
753+
754+ static bool doHandleConstStatusOrAccessorMemberCall (
744755 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
745756 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
746757 assert (isStatusOrType (Expr->getType ()));
747758 if (RecordLoc == nullptr )
748- return ;
759+ return false ;
749760 const FunctionDecl *DirectCallee = Expr->getDirectCallee ();
750761 if (DirectCallee == nullptr )
751- return ;
762+ return false ;
752763 StorageLocation &Loc =
753764 State.Lattice .getOrCreateConstMethodReturnStorageLocation (
754765 *RecordLoc, DirectCallee, State.Env , [&](StorageLocation &Loc) {
@@ -760,8 +771,15 @@ static void handleConstStatusOrAccessorMemberCall(
760771 } else {
761772 State.Env .setStorageLocation (*Expr, Loc);
762773 }
774+ return true ;
763775}
764776
777+ static void handleConstStatusOrAccessorMemberCall (
778+ const CallExpr *Expr, RecordStorageLocation *RecordLoc,
779+ const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
780+ if (!doHandleConstStatusOrAccessorMemberCall (Expr, RecordLoc, Result, State))
781+ transferStatusOrReturningCall (Expr, State);
782+ }
765783static void handleConstStatusOrPointerAccessorMemberCall (
766784 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
767785 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
@@ -803,16 +821,6 @@ static void transferConstStatusOrPointerAccessorMemberOperatorCall(
803821 handleConstStatusOrPointerAccessorMemberCall (Expr, RecordLoc, Result, State);
804822}
805823
806- static void transferStatusOrReturningCall (const CallExpr *Expr,
807- LatticeTransferState &State) {
808- RecordStorageLocation *StatusOrLoc =
809- Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
810- : State.Env .get <RecordStorageLocation>(*Expr);
811- if (StatusOrLoc != nullptr &&
812- State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
813- initializeStatusOr (*StatusOrLoc, State.Env );
814- }
815-
816824static void handleNonConstMemberCall (const CallExpr *Expr,
817825 RecordStorageLocation *RecordLoc,
818826 const MatchFinder::MatchResult &Result,
0 commit comments