This is an archive of the discontinued LLVM Phabricator instance.

[clang] [WIP] Don't plumb access specifier attributes through Parser unnecessarily.
AbandonedPublic

Authored by mboehme on May 20 2022, 6:42 AM.

Details

Summary

I noticed that a lot of functions in the parser take an AccessAttrs parameter,
even though, as far as I can tell, it's sufficient to handle access specifier
attributes locally where the access specifier is parsed.

I have removed all of this plumbing, and tests still pass. Much of the code
involved is pretty old, so I suspect this plumbing was required at some point
but that the underlying reason has now been eliminated. It may also be that at
some point people started simply following the pattern of "pass AccessAttrs
wherever an AccessSpecifier is passed".

However, I would appreciate a close look from someone who's more familiar with
the code than I am.

Diff Detail

Event Timeline

mboehme created this revision.May 20 2022, 6:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 20 2022, 6:42 AM
mboehme requested review of this revision.May 20 2022, 6:42 AM
Herald added a project: Restricted Project. · View Herald Transcript
mboehme retitled this revision from [clang] Don't plumb access specifier attributes through Parser unnecessarily. to [clang] [WIP] Don't plumb access specifier attributes through Parser unnecessarily..Jun 1 2022, 1:29 AM

I erroneously stated in the description that all tests pass, but as the CI shows, this is actually not true. Marking this as "WIP" until I figure out whether this change can be salvaged or should be abandoned.

mboehme abandoned this revision.Jun 1 2022, 4:37 AM

Apologies, I had thoroughly misunderstood how this works. Specifically, what wasn't clear to me is that attributes added to the access specifier are added to every member below it until the next access specifier. With that, all of this code is obviously needed.

I'm using a custom test runner setup that unfortunately happened not to run the tests that ended up failing.

Abandoning this change.