Skip to content

[AST] Do not copy SearchPathOptions in updateNonUserModule #64593

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
merged 1 commit into from
Mar 25, 2023

Conversation

bnbarham
Copy link
Contributor

@bnbarham bnbarham commented Mar 23, 2023

updateNonUserModule was accidentally copying SearchPathOptions. Take
a reference to it instead. Also, since addFile is actually called many
times (once for every submodule, of which there are many), change
isNonUserModule to a request so that it's only calculated when needed.

Resolves rdar://107155587.

@bnbarham
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor

FWIW it may be worth turning isNonUserModule into a cached request at some point, as files should never be added to a module after-the-fact (I've been meaning to replace addFile with a callable-one-time-only setFiles method, but have never gotten around to it), and flags such as setIsSystemModule should never change.

@bnbarham
Copy link
Contributor Author

FWIW it may be worth turning isNonUserModule into a cached request at some point, as files should never be added to a module after-the-fact (I've been meaning to replace addFile with a callable-one-time-only setFiles method, but have never gotten around to it), and flags such as setIsSystemModule should never change.

I'm happy to just do that now. Thanks for the suggestion 👍

@bnbarham bnbarham force-pushed the slow-is-system-check branch from 2041a3f to 733fc6f Compare March 24, 2023 19:23
@bnbarham bnbarham changed the title [AST] Do not copy SearchPathOptions [AST] Do not copy SearchPathOptions in updateNonUserModule Mar 24, 2023
@bnbarham bnbarham requested a review from hamishknight March 24, 2023 19:24
@bnbarham
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

`updateNonUserModule` was accidentally copying `SearchPathOptions`. Take
a reference to it instead. Also, since `addFile` is actually called many
times (once for every submodule, of which there are many), change
`isNonUserModule` to a request so that it's only calculated when needed.

Resolves rdar://107155587.
@bnbarham bnbarham force-pushed the slow-is-system-check branch from 733fc6f to 8e6c996 Compare March 25, 2023 00:06
@bnbarham bnbarham requested a review from rintaro as a code owner March 25, 2023 00:06
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham bnbarham merged commit 88c28cd into swiftlang:main Mar 25, 2023
@bnbarham bnbarham deleted the slow-is-system-check branch March 25, 2023 19:02
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.

5 participants