Skip to content

🍒[libclang] [Dependency Scanning] Diagnosing Out-Of-Date File System Cache Entries #11064

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 6 commits into from
Jul 28, 2025

Conversation

qiongsiwu
Copy link

This PR cherry-picks all the relevant PRs to diagnose out-of-date dependency scanning file system cache entries.

@qiongsiwu qiongsiwu requested a review from a team as a code owner July 25, 2025 15:36
…ve Stat Cache Entries (llvm#135703)

We have had numerous situations where the negatively stat cached paths
are invalidated during the build, and such invalidations lead to build
errors.

This PR adds an API to diagnose such cases.
`DependencyScanningFilesystemSharedCache::diagnoseNegativeStatCachedPaths`
allows users of the cache to ask the cache to examine all negatively
stat cached paths, and re-stat the paths using the passed-in file
system. If any re-stat succeeds, the API emits diagnostics.

rdar://149147920
(cherry picked from commit 9ef9167)
llvm#138955)

This PR makes a minor modification to make it more stable. The only
change is adding a suffix to the path under test.

rdar://149147920
(cherry picked from commit 2017831)
…4105)

`DependencyScanningFileSystemSharedCache` can currently report
out-of-date negatively stat cached paths. This PR enhances the reporting
with two modifications.

1. The reported path are now null terminated char arrays instead of
`StringRef`s. This way the API's user can avoid copying `StringRef`s to
other containers because the char arrays can be used directly.
2. The API now reports out-of-date cache entry due to file size changes.
Specifically, we check each file's cached size against the size of the
same file on the underlying FS. If the sizes are different, diagnostics
will be reported.

rdar://152247357
(cherry picked from commit 51d1385)
…try Reporting C-APIs (llvm#10927)

This PR implements the C-APIs to report a scanning file system cache's out-of-date entries. The C-APIs contains a function to return a set of file system cache out-of-date entries, functions to facilitate looping through all the entries, and reporting the relevant information from the entries.

The APIs are based on llvm#144105.

rdar://152247357
(cherry picked from commit 6fbcea6)
…en Computing Out-of-Date File System Cache Entries (llvm#148082)

We noticed that when a directory's content changes, its size reported by
`status` can change as well. We do not want to include such "false
positive" cases. This PR revises the computation so that only regular
file size changes are considered out-of-date.

rdar://152247357
(cherry picked from commit 5c08bfa)
… C-APIs. (llvm#10992)

swiftlang#10927 added a set of C-APIs to report out-of-date scanning file system cache entires. The C-APIs missed their visibility attributes. This PR adds `CINDEX_LINKAGE` to all APIs added by swiftlang#10927.

rdar://152247357
(cherry picked from commit d7f7e88)
@qiongsiwu
Copy link
Author

@swift-ci please test.

@qiongsiwu qiongsiwu self-assigned this Jul 25, 2025
@qiongsiwu qiongsiwu merged commit 1439587 into swiftlang:stable/20240723 Jul 28, 2025
2 of 3 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.

1 participant