[clang] [CIR] Upstream initial support for union type (PR #137501)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 10:53:12 PDT 2025
================
@@ -306,3 +320,71 @@ CIRGenTypes::computeRecordLayout(const RecordDecl *rd, cir::RecordType *ty) {
// TODO: implement verification
return rl;
}
+
+void CIRRecordLowering::lowerUnion() {
+ CharUnits layoutSize = astRecordLayout.getSize();
+ mlir::Type storageType = nullptr;
+ bool seenNamedMember = false;
+
+ // Iterate through the fields setting bitFieldInfo and the Fields array. Also
+ // locate the "most appropriate" storage type. The heuristic for finding the
----------------
andykaylor wrote:
I'm not sure what any of this comment after "locate the 'most appropriate' storage type" means. The comment was carried over from the classic codegen, but I wonder if it means we're doing a lot of work here that we don't need to do.
https://github.com/llvm/llvm-project/pull/137501
More information about the cfe-commits
mailing list