[LLDB] Fix handling of bit-fields in a union

When parsing DWARF and laying out bit-fields we don't properly take into account when they are in a union, they will all have a zero offset.

Differential Revision: https://reviews.llvm.org/D91118
This commit is contained in:
shafik
2020-11-12 11:22:02 -08:00
parent d5e89e8fc1
commit bae9aedb34
3 changed files with 30 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ int main(int argc, char const *argv[]) {
f.i = 1;
f.j = 0;
f.k = 1;
}
}
} clang_example;
class B {
@@ -70,6 +70,18 @@ int main(int argc, char const *argv[]) {
uint32_t d_a : 1;
} derived;
union union_with_bitfields {
unsigned int a : 8;
unsigned int b : 16;
unsigned int c : 32;
unsigned int x;
} uwbf;
union union_with_unnamed_bitfield {
unsigned int : 16, a : 24;
unsigned int x;
} uwubf;
lba.a = 2;
lbb.a = 1;
@@ -89,5 +101,8 @@ int main(int argc, char const *argv[]) {
derived.b_a = 2;
derived.d_a = 1;
uwbf.x = 0xFFFFFFFF;
uwubf.x = 0xFFFFFFFF;
return 0; // Set break point at this line.
}