================
@@ -7818,6 +7819,35 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, 
QualType DestTy,
   return prepareVectorSplat(DestTy, CastExpr);
 }
 
+/// Check that a call to alloc_size function specifies sufficient space for the
+/// destination type.
+static void CheckSufficientAllocSize(Sema &S, QualType DestType,
+                                     const Expr *E) {
+  QualType SourceType = E->getType();
+  if (!DestType->isPointerType() || !SourceType->isPointerType() ||
+      DestType == SourceType)
+    return;
+
+  const auto *CE = dyn_cast<CallExpr>(E->IgnoreCasts());
----------------
vvuksanovic wrote:

It should be fine to skip all casts (as long as they are valid) and we do want 
to skip explicit casts like `(void*)malloc(...)`. Parentheses should be skipped 
though, that is now corrected.

https://github.com/llvm/llvm-project/pull/150028
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to