aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenModule.cpp
diff options
context:
space:
mode:
authorMorris Hafner <mmha@users.noreply.github.com>2025-09-04 23:10:47 +0200
committerGitHub <noreply@github.com>2025-09-04 23:10:47 +0200
commit1dbe65a008ea7731bf91910ddeb13f53758db5c2 (patch)
tree9f5cb0197179a516f94daba6453d261083e70d22 /clang/lib/CIR/CodeGen/CIRGenModule.cpp
parent5a0be9b2a47d48b0f4410e0061312edf1fc7bee5 (diff)
downloadllvm-1dbe65a008ea7731bf91910ddeb13f53758db5c2.zip
llvm-1dbe65a008ea7731bf91910ddeb13f53758db5c2.tar.gz
llvm-1dbe65a008ea7731bf91910ddeb13f53758db5c2.tar.bz2
[CIR] Add constant record ILE support (#155663)
This patch adds basic support for constant record initializer list expressions. There's a couple of limitations: * No zero initialized padding bytes in C mode * No bitfields * No designated initializer lists * Record alignments are not calculated, yet * ILEs of derived records don't work, yet * The constant attribute is not propagated to the backend, resulting in non-constants being emitted in the LLVM IR
Diffstat (limited to 'clang/lib/CIR/CodeGen/CIRGenModule.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 0b3453b..eef23a0 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -93,6 +93,9 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext,
astContext.getTargetInfo().getPointerAlign(LangAS::Default))
.getQuantity();
+ const unsigned charSize = astContext.getTargetInfo().getCharWidth();
+ UCharTy = cir::IntType::get(&getMLIRContext(), charSize, /*isSigned=*/false);
+
// TODO(CIR): Should be updated once TypeSizeInfoAttr is upstreamed
const unsigned sizeTypeSize =
astContext.getTypeSize(astContext.getSignedSizeType());