aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CIR/CodeGen/CIRGenFunction.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/CIRGenFunction.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/CIRGenFunction.cpp')
-rw-r--r--clang/lib/CIR/CodeGen/CIRGenFunction.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
index fd413fe..c029853 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.cpp
@@ -550,6 +550,15 @@ LValue CIRGenFunction::makeNaturalAlignPointeeAddrLValue(mlir::Value val,
return makeAddrLValue(Address(val, align), ty, baseInfo);
}
+LValue CIRGenFunction::makeNaturalAlignAddrLValue(mlir::Value val,
+ QualType ty) {
+ LValueBaseInfo baseInfo;
+ CharUnits alignment = cgm.getNaturalTypeAlignment(ty, &baseInfo);
+ Address addr(val, convertTypeForMem(ty), alignment);
+ assert(!cir::MissingFeatures::opTBAA());
+ return makeAddrLValue(addr, ty, baseInfo);
+}
+
clang::QualType CIRGenFunction::buildFunctionArgList(clang::GlobalDecl gd,
FunctionArgList &args) {
const auto *fd = cast<FunctionDecl>(gd.getDecl());