================ @@ -2263,15 +2263,27 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler { MsgParam = 3; } else if (const auto *ECE = dyn_cast<ExplicitCastExpr>(Operation)) { QualType destType = ECE->getType(); - const uint64_t dSize = - Ctx.getTypeSize(destType.getTypePtr()->getPointeeType()); - if (const auto *CE = dyn_cast<CXXMemberCallExpr>(ECE->getSubExpr())) { - QualType srcType = CE->getType(); - const uint64_t sSize = - Ctx.getTypeSize(srcType.getTypePtr()->getPointeeType()); - if (sSize >= dSize) + if (!isa<PointerType>(destType)) + return; + + const Expr *subExpr = ECE->getSubExpr(); + // Check if related to DataInvocation warning gadget. ---------------- ziqingluo-90 wrote:
nitpick: not sure if we need this check. `DataInvocation` warning gadget is the only possible explicit-cast kind `Operation` here. This is completely my personal taste: this function sort of implies unique correspondence between warning gadgets and `Operation` kinds if without the check. https://github.com/llvm/llvm-project/pull/78815 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits