[clang] [CIR] Handle empty unions in record lowering and LLVM conversion (PR #172666)

Akimasa Watanuki via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 9 03:13:56 PST 2026


================
@@ -2969,6 +2969,12 @@ static void prepareTypeConverter(mlir::LLVMTypeConverter &converter,
       break;
     // Unions are lowered as only the largest member.
     case cir::RecordType::Union:
+      if (type.getMembers().empty()) {
+        if (type.getPadded())
+          llvmMembers.push_back(
----------------
Men-cotton wrote:

Thank you for pointing this out!

I added the assertion and ran it locally, and confirmed that this was indeed unnecessary. So, I have deleted this.

I do not have access to commit, so if there are no additional issues, please merge it.

https://github.com/llvm/llvm-project/pull/172666


More information about the cfe-commits mailing list