[clang] [CIR] Fix union RecordType::getTypeSizeInBits to return bits (PR #191516)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri May 22 08:20:26 PDT 2026
================
@@ -378,8 +378,12 @@ PointerType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
llvm::TypeSize
RecordType::getTypeSizeInBits(const mlir::DataLayout &dataLayout,
mlir::DataLayoutEntryListRef params) const {
- if (isUnion())
- return dataLayout.getTypeSize(getLargestMember(dataLayout));
+ if (isUnion()) {
+ mlir::Type largest = getLargestMember(dataLayout);
+ if (!largest)
+ return llvm::TypeSize::getFixed(0);
----------------
andykaylor wrote:
`sizeof` says it's 1.
https://github.com/llvm/llvm-project/pull/191516
More information about the cfe-commits
mailing list