[all-commits] [llvm/llvm-project] a7e7f5: [lldb] Remove anon struct from frame-var-anon-unio...
Dave Lee via All-commits
all-commits at lists.llvm.org
Sat Jan 15 10:22:00 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a7e7f541c0813e9d3f6c641ad8ff89619ec749d8
https://github.com/llvm/llvm-project/commit/a7e7f541c0813e9d3f6c641ad8ff89619ec749d8
Author: Dave Lee <davelee.com at gmail.com>
Date: 2022-01-15 (Sat, 15 Jan 2022)
Changed paths:
M lldb/test/API/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
M lldb/test/API/lang/cpp/frame-var-anon-unions/main.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list