[clang] [CIR] Accept a union covered only by a bit-field's declared type (PR #222108)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 13:55:03 PDT 2026
================
@@ -1487,6 +1487,14 @@ BitFieldType::getABIAlignment(const mlir::DataLayout &dataLayout,
return 1;
}
+std::optional<uint64_t> BitFieldType::getDeclaredExtentInBits(
+ const mlir::DataLayout &dataLayout) const {
+ if (getFields().size() != 1)
+ return std::nullopt;
+ return dataLayout.getTypeSizeInBits(getFields().front().getDeclaredType())
----------------
andykaylor wrote:
Yes, if the function only gets the extent if there is only one field, I think the function name should reflect that.
https://github.com/llvm/llvm-project/pull/222108
More information about the cfe-commits
mailing list