[clang] [X86_64] fix empty structure vaarg in c++ (PR #77907)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 18:24:05 PDT 2024


================
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -x c -o - %s | FileCheck %s
+
+typedef struct { struct {} a; } empty;
+
+// CHECK-LABEL: define{{.*}} void @{{.*}}empty_record_test{{.*}}()
+empty empty_record_test(void) {
+// CHECK: [[RET:%[a-z]+]] = alloca %struct.empty, align 1
----------------
efriedma-quic wrote:

This test doesn't really make it obvious that this is working the way you want; I mean, the existence of TMP sort of hints at it, but it's not comprehensive.

I'd suggest:

- Make the va_list an argument to the function, instead of declaring it as a local.
- Consider autogenerating the CHECK lines using update_cc_test_checks.py

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


More information about the cfe-commits mailing list