[clang] [clang][CodeGen] Zero init unspecified fields in initializers in C (PR #97121)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 17:18:56 PDT 2024


https://github.com/efriedma-quic commented:

It probably makes sense to add a helper like the following to CodeGenModule or something like that:

```
bool shouldZeroInitPadding() { 
  // Comment explaining reasoning for this rule
  return !CGM.getLangOpts().CPlusPlus;
}
```

So we don't have `// See comment in getPadding().` all over the place.

----

Is there any relevant code using EmitNullConstant()?  As far as I can tell, this patch doesn't  zero-fill implicit padding in null constants (like in `struct { int x; long y; }`.

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


More information about the cfe-commits mailing list