[clang] [CIR] Add basic support for operator new (PR #145802)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 26 12:45:19 PDT 2025
================
@@ -95,6 +95,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
// TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed
const unsigned sizeTypeSize =
astContext.getTypeSize(astContext.getSignedSizeType());
+ SizeSizeInBytes = astContext.toCharUnitsFromBits(sizeTypeSize).getQuantity();
----------------
andykaylor wrote:
> Ah, huh... that is undefined behavior...
Oh, right. You caught me thinking like a C programmer (very old habit). I'm pretty sure that is the intent of the original code though. This part, at least, I can confidently fix. I agree with @bcardosolopes about the long-term solution, but I will avoid introducing this union for now.
https://github.com/llvm/llvm-project/pull/145802
More information about the cfe-commits
mailing list