llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

<details>
<summary>Changes</summary>

This is the root-cause for the LLDB failures that started occurring after 
https://github.com/llvm/llvm-project/pull/105865.

The DWARFASTParserClang has logic to try derive unnamed bitfields from DWARF 
offsets. In this case we treat `padding` as a 1-byte size field that would 
overlap with `flag`, and decide we need to introduce an unnamed bitfield into 
the AST, which is incorrect.

---
Full diff: https://github.com/llvm/llvm-project/pull/108155.diff


1 Files Affected:

- (added) lldb/test/Shell/SymbolFile/DWARF/no_unique_address-with-bitfields.cpp 
(+30) 


``````````diff
diff --git 
a/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-with-bitfields.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-with-bitfields.cpp
new file mode 100644
index 00000000000000..950bd9585baa22
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/no_unique_address-with-bitfields.cpp
@@ -0,0 +1,30 @@
+// LLDB currently erroneously adds an unnamed bitfield
+// into the AST when a overlapping no_unique_address
+// field precedes a bitfield.
+
+// XFAIL: *
+
+// RUN: %clangxx_host -gdwarf -o %t %s
+// RUN: %lldb %t \
+// RUN:   -o "target var global" \
+// RUN:   -o "image dump ast" \
+// RUN:   -o exit | FileCheck %s
+
+// CHECK:      (lldb) image dump ast
+// CHECK-NEXT: CXXRecordDecl {{.*}} struct Foo definition
+// CHECK:      |-FieldDecl {{.*}} data 'char[5]'
+// CHECK-NEXT: |-FieldDecl {{.*}} padding 'Empty'
+// CHECK-NEXT: |-FieldDecl {{.*}} 'int'
+// CHECK-NEXT: | `-IntegerLiteral {{.*}} 'int' 8
+// CHECK-NEXT: `-FieldDecl {{.*}} sloc> mem 'unsigned long'
+// CHECK-NEXT:   `-IntegerLiteral {{.*}} 'int' 1
+
+struct Empty {};
+
+struct Foo {
+  char data[5];
+  [[no_unique_address]] Empty padding;
+  unsigned long flag : 1;
+};
+
+Foo global;

``````````

</details>


https://github.com/llvm/llvm-project/pull/108155
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to