Skip to content

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Apr 4, 2023

To ensure that class vtables get laid out with the right ABI, visiting a class declaration visits all of its "ABI members", which includes visiting all of the auxiliary declarations. However, we also visit the auxiliary declarations of every declaration, which means some declarations get visited twice.

This led to another oddly-specific bug for macros, where we would visit declarations introduce by peer macros on class members twice. When combined with function-body-skipping (e.g., to emit a module file), this would result in spurious errors of the form:

Expected '{' in body of function declaration

Stop visiting the auxiliary declarations of class members twice, eliminating this error. This one has been annoying me off and on for a while :).

Fixes rdar://107429169.


Cherry pick of #64915.

To ensure that class vtables get laid out with the right ABI, visiting
a class declaration visits all of its "ABI members", which includes
visiting all of the auxiliary declarations. However, we also visit the
auxiliary declarations of every declaration, which means some
declarations get visited twice.

This led to another oddly-specific bug for macros, where we would
visit declarations introduce by peer macros on class members twice.
When combined with function-body-skipping (e.g., to emit a module
file), this would result in spurious errors of the form:

    Expected '{' in body of function declaration

Stop visiting the auxiliary declarations of class members twice,
eliminating this error. This one has been annoying me off and on for a
while :).

Fixes rdar://107429169.
@DougGregor DougGregor requested a review from a team as a code owner April 4, 2023 18:56
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit e840d9a into swiftlang:release/5.9 Apr 5, 2023
@DougGregor DougGregor deleted the visit-aux-decls-of-class-members-twice-5.9 branch April 5, 2023 00:15
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented May 3, 2023

Cherry pick of #64915.

@AnthonyLatsis AnthonyLatsis added the 🍒 release cherry pick Flag: Release branch cherry picks label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants