@@ -863,15 +863,26 @@ static void transferPointerToBoolean(const ImplicitCastExpr *Expr,
863863 dyn_cast_or_null<BoolValue>(State.Env .getValue (*Expr->getSubExpr ())))
864864 State.Env .setValue (*Expr, *SubExprVal);
865865}
866- static void handleConstStatusOrAccessorMemberCall (
866+
867+ static void transferStatusOrReturningCall (const CallExpr *Expr,
868+ LatticeTransferState &State) {
869+ RecordStorageLocation *StatusOrLoc =
870+ Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
871+ : State.Env .get <RecordStorageLocation>(*Expr);
872+ if (StatusOrLoc != nullptr &&
873+ State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
874+ initializeStatusOr (*StatusOrLoc, State.Env );
875+ }
876+
877+ static bool doHandleConstStatusOrAccessorMemberCall (
867878 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
868879 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
869880 assert (isStatusOrType (Expr->getType ()));
870881 if (RecordLoc == nullptr )
871- return ;
882+ return false ;
872883 const FunctionDecl *DirectCallee = Expr->getDirectCallee ();
873884 if (DirectCallee == nullptr )
874- return ;
885+ return false ;
875886 StorageLocation &Loc =
876887 State.Lattice .getOrCreateConstMethodReturnStorageLocation (
877888 *RecordLoc, DirectCallee, State.Env , [&](StorageLocation &Loc) {
@@ -883,8 +894,15 @@ static void handleConstStatusOrAccessorMemberCall(
883894 } else {
884895 State.Env .setStorageLocation (*Expr, Loc);
885896 }
897+ return true ;
886898}
887899
900+ static void handleConstStatusOrAccessorMemberCall (
901+ const CallExpr *Expr, RecordStorageLocation *RecordLoc,
902+ const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
903+ if (!doHandleConstStatusOrAccessorMemberCall (Expr, RecordLoc, Result, State))
904+ transferStatusOrReturningCall (Expr, State);
905+ }
888906static void handleConstStatusOrPointerAccessorMemberCall (
889907 const CallExpr *Expr, RecordStorageLocation *RecordLoc,
890908 const MatchFinder::MatchResult &Result, LatticeTransferState &State) {
@@ -926,16 +944,6 @@ static void transferConstStatusOrPointerAccessorMemberOperatorCall(
926944 handleConstStatusOrPointerAccessorMemberCall (Expr, RecordLoc, Result, State);
927945}
928946
929- static void transferStatusOrReturningCall (const CallExpr *Expr,
930- LatticeTransferState &State) {
931- RecordStorageLocation *StatusOrLoc =
932- Expr->isPRValue () ? &State.Env .getResultObjectLocation (*Expr)
933- : State.Env .get <RecordStorageLocation>(*Expr);
934- if (StatusOrLoc != nullptr &&
935- State.Env .getValue (locForOk (locForStatus (*StatusOrLoc))) == nullptr )
936- initializeStatusOr (*StatusOrLoc, State.Env );
937- }
938-
939947static void handleNonConstMemberCall (const CallExpr *Expr,
940948 RecordStorageLocation *RecordLoc,
941949 const MatchFinder::MatchResult &Result,
0 commit comments