[clang] [Clang] Handle structs with inner structs and no fields (PR #89126)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 13:15:15 PDT 2024


================
@@ -844,7 +847,18 @@ const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
       if (const FieldDecl *Field =
----------------
bwendling wrote:

I did several tests, and it looks like if there's an inner struct that's not accessible, that doesn't affect the offsets of fields outside of that inner struct.

```c
struct foo {
  struct inner_1 {
    /* fields */
  };
  struct inner_2 {
    int a;               /* __builtin_offsetof is 0 */
  };
  int b;                 /* __builtin_offsetof is 0 */
};
```

@efriedma-quic Do you have any thoughts?


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


More information about the cfe-commits mailing list