[Lldb-commits] [lldb] [LLDB] Fix GetIndexOfChildMemberWithName to handle anonymous structs. (PR #138487)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon May 5 23:56:30 PDT 2025


================
@@ -0,0 +1,33 @@
+int main(int argc, char** argv) {
+  struct A {
+    struct {
+      int x = 1;
+    };
+    int y = 2;
+  } a;
+
+   struct B {
+    // Anonymous struct inherits another struct.
+    struct : public A {
+      int z = 3;
+    };
+    int w = 4;
+    A a;
+  } b;
+
+   struct : public A {
+     struct {
+       int z = 13;
+     };
+   } unnamed_derived;
+
+   struct DerivedB : public B {
+     struct {
+       // `w` in anonymous struct overrides `w` from `B`.
----------------
labath wrote:

I think the precise term is "shadows"

https://github.com/llvm/llvm-project/pull/138487


More information about the lldb-commits mailing list