================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to