Skip to content

[clang][modules] Detect invalidation of SDKSettings.json #10661

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 3 commits into
base: next
Choose a base branch
from

Conversation

jansvoboda11
Copy link

@jansvoboda11 jansvoboda11 commented May 9, 2025

The input file section in module files only stores files loaded into the SourceManager. When rebuilding the module cache, include-trees also include other files, like the SDKSettings.json file. If we don't invalidate the module cache when that file changes, the corresponding include-trees won't agree with the primary TU include-tree on the file contents. This PR makes it so that we do track that file in module files, triggering module cache and therefore include-tree rebuilds, which makes the whole system have a consistent view of the file.

The is implemented by loading the SDKSettings.json file into SourceManager. Note that this doesn't handle all other extra files contained in the include-tree, because I don't think this is a reasonable long-term solution, but the SDKSettings.json file is the one immediately causing issues.

I intentionally suppress reporting of this new file in tests, so that I don't have go updating ~all of them. This file is getting reported by the scanning C API, so that the build system is given the ability to eventually act on this file being out-of-date.

rdar://149868539

@jansvoboda11
Copy link
Author

I think the long-term solution is to decouple input files from the SourceManager and have a way to extend the input files written into the PCM with files from the include tree. These are bigger changes that I don't think are reasonable for the upcoming release, so this is just the minimal fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants