aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
authorAndy Kaylor <akaylor@nvidia.com>2025-06-24 10:05:48 -0700
committerGitHub <noreply@github.com>2025-06-24 10:05:48 -0700
commit418b409df8538bdf1b4865556607c220dc139fa8 (patch)
treee8d4cae5cc0df380d02642745b704100ff1cf649 /clang/lib/CIR/CodeGen/CIRGenModule.cpp
parent7150b2c76a7102f089eb8b81d704773f2eb7c307 (diff)
downloadllvm-418b409df8538bdf1b4865556607c220dc139fa8.zip
llvm-418b409df8538bdf1b4865556607c220dc139fa8.tar.gz
llvm-418b409df8538bdf1b4865556607c220dc139fa8.tar.bz2
[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.
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp4
1 files changed, 4 insertions, 0 deletions
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);