[clang] [clang][CGRecordLayout] Remove dependency on isZeroSize (PR #96422)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 13:00:45 PDT 2024
================
@@ -1,7 +1,17 @@
-// RUN: %clang_cc1 -emit-llvm < %s | grep "zeroinitializer, i16 16877"
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// PR4390
struct sysfs_dirent {
- union { struct sysfs_elem_dir {} s_dir; };
+ union { struct sysfs_elem_dir { int x; } s_dir; };
unsigned short s_mode;
};
struct sysfs_dirent sysfs_root = { {}, 16877 };
+
+// CHECK: @sysfs_root = global %struct.sysfs_dirent { %union.anon zeroinitializer, i16 16877 }
+
+struct Foo {
+ union { struct empty {} x; };
+ unsigned short s_mode;
----------------
efriedma-quic wrote:
This looks weird at first glance, but I guess the union has size zero in C, so this is fine.
https://github.com/llvm/llvm-project/pull/96422
More information about the cfe-commits
mailing list