[clang] [llvm] [LLVMABI][AARCH64] Handle condtions for ignoring empty types (PR #224476)

Madhur Amilkanthwar via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 23:17:25 PDT 2026


================
@@ -794,4 +794,78 @@ TEST_F(AArch64TargetInfoTest, ClassifyArgumentOveralignedHFAAlign) {
   }
 }
 
+// Empty records and zero-size types are ignored as returns under all AArch64
+// ABI kinds. Empty C arguments are ignored; Darwin also ignores empty C++
+// arguments. C++ AAPCS/Win64 only ignore zero-size types.
+TEST_F(AArch64TargetInfoTest, ClassifyEmptyAndZeroSizeIgnore) {
+  const ABIType *EmptyC = makeRecord({}, 0, llvm::Align(1),
+                                     /*UnadjustedAlign=*/llvm::Align(1));
+  const ABIType *EmptyUnion =
+      TB.getUnionType({}, llvm::TypeSize::getFixed(0), llvm::Align(1),
+                      /*UnadjustedAlign=*/llvm::Align(1),
+                      StructPacking::Default, RecordFlags::CanPassInRegisters);
+  const ABIType *EmptyCXX =
+      makeRecord({}, 8, llvm::Align(1), /*UnadjustedAlign=*/llvm::Align(1),
+                 passableRecordFlags(/*IsCXX=*/true));
+  const ABIType *ZeroArr = TB.getArrayType(I32, /*NumElements=*/0,
+                                           /*SizeInBits=*/0);
+  const ABIType *ZeroSizeCXX = makeRecord(
----------------
madhur13490 wrote:

ZeroSizeCXX is both empty and zero-sized, so the C++ assertions pass whichever branch fires. Could you add a comment saying so? As written it looks like it pins the Size == 0 path specifically.

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


More information about the cfe-commits mailing list