Skip to content

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

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

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jun 16, 2025

When compiling a file that requires a module to be compiled, we cloned the compiler instance for the module compile. This means that the cloned compiler instance still had the index store path and index unit output path of the original file. We were thus generating a unit file with the original file name for the compiled module. This unit file would ultimately get overwritten when the original source file was compiled, so there was no correctness issue per se but this means we were doing unnecessary work.

Disable emitting an index store for module compiles to fix this.

Compared to #10846, this reduces the overhead of index-while-building by 8.2% (3.00% to 2.76%), based on a single test project with indexing of PCMs disabled.

@ahoppen ahoppen requested a review from bnbarham June 16, 2025 16:49
@ahoppen
Copy link
Member Author

ahoppen commented Jun 16, 2025

@swift-ci Please test llvm

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 force-pushed the dont-index-implicit-modules branch from 65189ef to 330b557 Compare June 16, 2025 18:32
@ahoppen
Copy link
Member Author

ahoppen commented Jun 16, 2025

@swift-ci Please test llvm

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.

1 participant