[clang] [CIR] Add support for array cleanups (PR #150499)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 25 12:28:03 PDT 2025
================
@@ -649,6 +649,41 @@ void CIRGenFunction::emitNullabilityCheck(LValue lhs, mlir::Value rhs,
assert(!cir::MissingFeatures::sanitizers());
}
+/// Destroys all the elements of the given array, beginning from last to first.
+/// The array cannot be zero-length.
+///
+/// \param begin - a type* denoting the first element of the array
+/// \param end - a type* denoting one past the end of the array
+/// \param elementType - the element type of the array
+/// \param destroyer - the function to call to destroy elements
+void CIRGenFunction::emitArrayDestroy(mlir::Value begin, mlir::Value end,
+ QualType elementType,
+ CharUnits elementAlign,
+ Destroyer *destroyer,
+ bool checkZeroLength) {
+ assert(!elementType->isArrayType());
+ if (checkZeroLength)
+ cgm.errorNYI("emitArrayDestroy: check for zero length");
----------------
andykaylor wrote:
You're right, though that means we will need to check for that condition in LowerPrepare when we implement support for VLAs.
https://github.com/llvm/llvm-project/pull/150499
More information about the cfe-commits
mailing list