Skip to content

Commit a7e7f54

Browse files
committed
[lldb] Remove anon struct from frame-var-anon-unions test
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 directly access the fields of the anonymous union, but can't directly access the fields of the anonymous struct variable. The second test, to directly 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 directly access them (other than perhaps as a regression test). Differential Revision: https://reviews.llvm.org/D116863
1 parent ff85dcb commit a7e7f54

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,3 @@ def test_with_run_command(self):
2929
self.expect('frame variable -f x i', substrs=['41ffff00'])
3030

3131
self.expect('frame variable c', substrs=["'A"])
32-
33-
self.expect('frame variable x', matching=False, substrs=['3'])
34-
self.expect('frame variable y', matching=False, substrs=["'B'"])
35-
self.expect('frame variable z', matching=False, substrs=['14'])

lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ int main() {
33
int i;
44
char c;
55
};
6-
struct {
7-
int x;
8-
char y;
9-
short z;
10-
} s{3,'B',14};
116
i = 0xFFFFFF00;
127
c = 'A';
138
return c; // break here

0 commit comments

Comments
 (0)