From 418b409df8538bdf1b4865556607c220dc139fa8 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Tue, 24 Jun 2025 10:05:48 -0700 Subject: [CIR] Add support for member initialization from constructors (#144583) Upstream the code to handle member variable initialization in a constructor. At this point only simple scalar values (including members of anonymous unions) are handled. --- clang/lib/CIR/CodeGen/CIRGenModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp') diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 434dd37..68ab81e 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -68,6 +68,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, // Initialize cached types VoidTy = cir::VoidType::get(&getMLIRContext()); + VoidPtrTy = cir::PointerType::get(VoidTy); SInt8Ty = cir::IntType::get(&getMLIRContext(), 8, /*isSigned=*/true); SInt16Ty = cir::IntType::get(&getMLIRContext(), 16, /*isSigned=*/true); SInt32Ty = cir::IntType::get(&getMLIRContext(), 32, /*isSigned=*/true); @@ -94,6 +95,9 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, // TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed const unsigned sizeTypeSize = astContext.getTypeSize(astContext.getSignedSizeType()); + // In CIRGenTypeCache, UIntPtrTy and SizeType are fields of the same union + UIntPtrTy = + cir::IntType::get(&getMLIRContext(), sizeTypeSize, /*isSigned=*/false); PtrDiffTy = cir::IntType::get(&getMLIRContext(), sizeTypeSize, /*isSigned=*/true); -- cgit v1.1