kastiglione created this revision. kastiglione added reviewers: JDevlieghere, jingham, aprantl. kastiglione requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
This test for anonymous unions seems off. It tests the following: union { // fields }; struct { // fields } var{...}; Both are anonymous types, but the first does not declare a variable and the second one does. The test then checks that `frame var` can access the fields of the anonymous union, but can't access the fields of the anonymous struct. The second test, to access the members of the struct variable, seems pointless as similar code would not compile. A demonstration: struct { int a; int z; } a_z{23, 45}; printf("%d\n", a_z.a); // fine printf("%d\n", a); // this does not compile Since we can't directly access the fields in code, I'm not sure there's a reason to test that lldb also can't access them (other than perhaps as a regression test). Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D116863 Files: lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp Index: lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp =================================================================== --- lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp +++ lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp @@ -3,11 +3,6 @@ int i; char c; }; - struct { - int x; - char y; - short z; - } s{3,'B',14}; i = 0xFFFFFF00; c = 'A'; return c; // break here Index: lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py =================================================================== --- lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py +++ lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py @@ -29,7 +29,3 @@ self.expect('frame variable -f x i', substrs=['41ffff00']) self.expect('frame variable c', substrs=["'A"]) - - self.expect('frame variable x', matching=False, substrs=['3']) - self.expect('frame variable y', matching=False, substrs=["'B'"]) - self.expect('frame variable z', matching=False, substrs=['14'])
Index: lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp =================================================================== --- lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp +++ lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp @@ -3,11 +3,6 @@ int i; char c; }; - struct { - int x; - char y; - short z; - } s{3,'B',14}; i = 0xFFFFFF00; c = 'A'; return c; // break here Index: lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py =================================================================== --- lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py +++ lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py @@ -29,7 +29,3 @@ self.expect('frame variable -f x i', substrs=['41ffff00']) self.expect('frame variable c', substrs=["'A"]) - - self.expect('frame variable x', matching=False, substrs=['3']) - self.expect('frame variable y', matching=False, substrs=["'B'"]) - self.expect('frame variable z', matching=False, substrs=['14'])
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits