[Lldb-commits] [clang] [lldb] [clang][lldb] Don't assert structure layout correctness for layouts provided by LLDB (PR #93809)
Eli Friedman via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 18 12:04:52 PDT 2024
efriedma-quic wrote:
> > couldn't the inverse be true, then - that codegen should ignore if something isZeroSize or not?
>
> Just to clarify, is the suggestion here to remove the special handling of `isZeroSize` in the RecordLayoutBuilder?
We currently need to distinguish between empty fields and non-empty fields: various parts of CodeGen expect to be able to get the LLVM struct field associated with a non-empty clang field. Maybe we can reduce that dependency, but that would be a deeper refactoring.
But we don't really care whether an empty field is formally "zero-size", so we could instead just check if the field is empty.
The change would be a bit wider than just RecordLayoutBuilder; there are other places in CodeGen that check isZeroSize for similar reasons.
> > That would mean if someone wrote `struct Empty {}; struct Z { Empty a,b,c; }`, we'd lower it to `{ [3 x i8] }` instead of `{%Empty, %Empty, %Empty}`, which is a bit ugly. Other than that, sure, I guess we could do that.
>
> Ah, fair enough. Glad to understand and I don't feel /super/ strongly either way. Though it might help with confidence if codegen didn't depend on this property at all (that it depends on the property a bit may make it harder to detect if later codegen depends on the property in a real/ABI-breaking way).
I think we have enough regression tests and assertions to detect breakage from minor adjustments here.
https://github.com/llvm/llvm-project/pull/93809
More information about the lldb-commits
mailing list