diff options
author | Amr Hesham <amr96@programmer.net> | 2025-04-03 19:25:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-03 19:25:25 +0200 |
commit | 262b9b515330daf7c446cc7983bf5f89185b3666 (patch) | |
tree | d966a0bd8004a67744590e83edf808b0c06b8927 /clang/lib/CIR/CodeGen/CIRGenModule.cpp | |
parent | 75142250527a97fcf0c721148705ae415a2f2d3a (diff) | |
download | llvm-262b9b515330daf7c446cc7983bf5f89185b3666.zip llvm-262b9b515330daf7c446cc7983bf5f89185b3666.tar.gz llvm-262b9b515330daf7c446cc7983bf5f89185b3666.tar.bz2 |
[CIR][Upstream] Local initialization for ArrayType (#132974)
This change adds local initialization for ArrayType
Issue #130197
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r-- | clang/lib/CIR/CodeGen/CIRGenModule.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 2a37d6c..d3b3b06 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -57,6 +57,18 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, FP80Ty = cir::FP80Type::get(&getMLIRContext()); FP128Ty = cir::FP128Type::get(&getMLIRContext()); + PointerAlignInBytes = + astContext + .toCharUnitsFromBits( + astContext.getTargetInfo().getPointerAlign(LangAS::Default)) + .getQuantity(); + + // TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed + const unsigned sizeTypeSize = + astContext.getTypeSize(astContext.getSignedSizeType()); + PtrDiffTy = + cir::IntType::get(&getMLIRContext(), sizeTypeSize, /*isSigned=*/true); + theModule->setAttr(cir::CIRDialect::getTripleAttrName(), builder.getStringAttr(getTriple().str())); } |