[Lldb-commits] [lldb] Fix a bug where an error was emitted for GCC union types. (PR #159401)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 22 02:06:10 PDT 2025
================
@@ -3142,7 +3142,11 @@ void DWARFASTParserClang::ParseSingleMember(
uint64_t parent_byte_size =
parent_die.GetAttributeValueAsUnsigned(DW_AT_byte_size, UINT64_MAX);
- if (attrs.member_byte_offset >= parent_byte_size) {
+ // If the attrs.member_byte_offset is still set to UINT32_MAX this means
+ // that the DW_TAG_member didn't have a DW_AT_data_member_location, so
+ // don't emit an error if this is the case.
+ if (attrs.member_byte_offset != UINT32_MAX &&
----------------
Michael137 wrote:
LGTM
Though there's a couple of follow-ups i think we could do:
1. Would be nice if `member_byte_offset` was an optional
2. Why is Clang emitting `DW_AT_data_member_location` for union members? Aren't they always `0x0` anyway. I assume that's why GCC chooses to omit them. Would be nice for Clang and GCC to align on this.
3. This condition seems silly:
```
member_array_size != 1 &&
(member_array_size != 0 ||
attrs.member_byte_offset > parent_byte_size
```
The `!= 0` is always `false` right?
https://github.com/llvm/llvm-project/pull/159401
More information about the lldb-commits
mailing list