[Lldb-commits] [clang] [lldb] [clang][RecordLayoutBuilder] Be stricter about inferring packed-ness in ExternalLayouts (PR #97443)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 2 10:41:52 PDT 2024
================
@@ -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
More information about the lldb-commits
mailing list