8000 [Index] Don't generate a unit file when building implicit modules by ahoppen · Pull Request #10877 · swiftlang/llvm-project · GitHub
[go: up one dir, main page]

Skip to content

[Index] Don't generate a unit file when building implicit modules #10877

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

ahoppen
Copy link
Member
@ahoppen ahoppen commented Jun 20, 2025

Cherry-pick of #10848 to stable/20240723


When compiling a file that requires a module to be compiled, we cloned the compiler instance for the module compile. If that compiler instance had an index unit output path set, we would use that name for the unit file of the pcm, which would get overwritten as soon as the unit for that source file is written at the end of that compilation process. Fix this issue by clearning the index unit output path for the PCM compilation process.

Also respect IndexIgnorePcms and don’t generate an index for the PCMs by clearning the IndexStorePath to disable indexing of the PCMs

When compiling a file that requires a module to be compiled, we cloned the compiler instance for the module compile. If that compiler instance had an index unit output path set, we would use that name for the unit file of the pcm, which would get overwritten as soon as the unit for that source file is written at the end of that compilation process. Fix this issue by clearning the index unit output path for the PCM compilation process.

Also respect `IndexIgnorePcms` and don’t generate an index for the PCMs by clearning the `IndexStorePath` to disable indexing of the PCMs
@ahoppen ahoppen requested a review from a team as a code owner June 20, 2025 11:02
@ahoppen
Copy link
Member Author
ahoppen commented Jun 20, 2025

@swift-ci Please test llvm

@akyrtzi
Copy link
akyrtzi commented Jun 21, 2025

Fix this issue by clearning the index unit output path for the PCM compilation process.

After this change does it still generate a unit file for the PCM but with a proper path?

@ahoppen
Copy link
Member Author
ahoppen commented Jun 23, 2025

Yes, the issue was that when implicitly building modules, we would clone the compiler instance, which would also retain the original invocation’s IndexUnitOutputPath. Because of this, the unit file name for the pcm would be the same as for the original source file to compile and thus get immediately overwritten by that source file’s source file. With this change, we generate a separate unit file for the pcm.

@ahoppen
Copy link
Member Author
ahoppen commented Jun 24, 2025

@swift-ci Please test

@ahoppen ahoppen merged commit a5adff9 into swiftlang:stable/20240723 Jun 24, 2025
5 checks passed
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.

2 participants
0