This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove anon struct from frame-var-anon-unions test
ClosedPublic

Authored by kastiglione on Jan 8 2022, 10:03 AM.

Details

Summary

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).

Diff Detail

Event Timeline

kastiglione requested review of this revision.Jan 8 2022, 10:03 AM
kastiglione created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2022, 10:03 AM

clarify commit message

kastiglione edited the summary of this revision. (Show Details)Jan 8 2022, 10:13 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 15 2022, 10:22 AM
This revision was automatically updated to reflect the committed changes.