Skip to content

Teach DeclContext::getParentSourceFile() to return the innermost source file #62911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 8, 2023

With macro expansions, and really any code generation that produces proper source locations, the parent source file of a declaration context will be a generated source file rather than the source file near the top of the declaration-context stack. Adjust the implementation of getParentSourceFile() to return that innermost source file by doing location-based lookup.

Fixes #62908

…ce file

With macro expansions, and really any code generation that produces
proper source locations, the parent source file of a declaration
context will be a generated source file rather than the source file
near the top of the declaration-context stack. Adjust the
implementation of `getParentSourceFile()` to return that innermost
source file by doing location-based lookup.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@DougGregor
Copy link
Member Author

The Windows failure is unrelated. Merging

@DougGregor DougGregor merged commit 08c5553 into swiftlang:main Jan 9, 2023
@DougGregor DougGregor deleted the parent-source-file-in-generated-buffers branch January 9, 2023 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decls in expanded macros trigger source buffer assertions
1 participant