================
@@ -2250,14 +2246,18 @@ void ItaniumRecordLayoutBuilder::UpdateAlignment(
}
}
-uint64_t
-ItaniumRecordLayoutBuilder::updateExternalFieldOffset(const FieldDecl *Field,
- uint64_t ComputedOffset)
{
+uint64_t ItaniumRecordLayoutBuilder::updateExternalFieldOffset(
+ const FieldDecl *Field, uint64_t ComputedOffset, uint64_t PreviousOffset) {
uint64_t ExternalFieldOffset = External.getExternalFieldOffset(Field);
- if (InferAlignment && ExternalFieldOffset < ComputedOffset) {
- // The externally-supplied field offset is before the field offset we
- // computed. Assume that the structure is packed.
+ // If the externally-supplied field offset is before the field offset we
+ // computed. Check against the previous field offset to make sure we don't
+ // misinterpret overlapping fields as packedness of the structure.
+ const bool assume_packed = ExternalFieldOffset > 0 &&
+ ExternalFieldOffset < ComputedOffset &&
+ ExternalFieldOffset > PreviousOffset;
----------------
Michael137 wrote:
Technically "overlapping" would have to account for size of the previous field
https://github.com/llvm/llvm-project/pull/97443
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits