[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:13 PDT 2025
================
@@ -230,17 +230,41 @@ void RecordType::complete(ArrayRef<Type> members, bool packed, bool padded) {
llvm_unreachable("failed to complete record");
}
+/// Return the largest member of in the type.
+///
+/// Recurses into union members never returning a union as the largest member.
+Type RecordType::getLargestMember(const ::mlir::DataLayout &dataLayout) const {
+ assert(isUnion() && "Only call getLargestMember on unions");
+ Type largestMember;
+ unsigned largestMemberSize = 0;
+ unsigned numElements = getNumElements();
+ auto members = getMembers();
----------------
andykaylor wrote:
Don't use auto here.
https://github.com/llvm/llvm-project/pull/137501
More information about the cfe-commits
mailing list