================ @@ -392,19 +393,26 @@ void DynamicTypePropagation::checkPostCall(const CallEvent &Call, } } -/// TODO: Handle explicit casts. -/// Handle C++ casts. -/// -/// Precondition: the cast is between ObjCObjectPointers. ExplodedNode *DynamicTypePropagation::dynamicTypePropagationOnCasts( const CastExpr *CE, ProgramStateRef &State, CheckerContext &C) const { // We only track type info for regions. const MemRegion *ToR = C.getSVal(CE).getAsRegion(); if (!ToR) return C.getPredecessor(); - if (isa<ExplicitCastExpr>(CE)) + if (CE->getCastKind() == CK_BaseToDerived) { + bool CastSucceeds = true; + QualType FromTy = CE->getSubExpr()->getType(); + QualType ToTy = CE->getType(); + ToR = ToR->StripCasts(/*StripBaseAndDerivedCasts=*/true); + State = setDynamicTypeAndCastInfo(State, ToR, FromTy, ToTy, CastSucceeds); ---------------- steakhal wrote:
I decided to hoist it to get a better formatting for the line. I didn't want to break it into two. https://github.com/llvm/llvm-project/pull/69057 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits