This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Handle symlinks in minimizing FS
ClosedPublic

Authored by jansvoboda11 on Dec 2 2021, 9:42 AM.

Details

Summary

The minimizing and caching filesystem used by the dependency scanner can be configured to not minimize some files. That's necessary when scanning a TU with prebuilt inputs (i.e. PCH) that refer to the original (non-minimized) files. Minimizing such files in the dependency scanner would cause discrepancy between the current perceived state of the filesystem and the file sizes stored in the AST file. By not minimizing such files, we avoid creating the discrepancy.

The problem with the current approach is that files that should not be minimized are identified by their path. This breaks down when the prebuilt input (PCH) and the current TU refer to the same file via different paths (i.e. symlinks). This patch switches from paths to llvm::sys::fs::UniqueID when identifying ignored files. This is consistent with how the rest of Clang treats files.

Depends on D114966.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Dec 2 2021, 9:42 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 2 2021, 9:42 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 edited the summary of this revision. (Show Details)Dec 2 2021, 9:59 AM
tschuett added inline comments.
clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
312–313

Do you want to modernise RequestedInformation to an enum class?

arphaman accepted this revision.Dec 6 2021, 9:03 AM

This looks good to me! I agree, an enum class would be cleaner though.

This revision is now accepted and ready to land.Dec 6 2021, 9:03 AM

Rebase on top of new version of D114966.

jansvoboda11 added 1 blocking reviewer(s): dexonsmith.Dec 17 2021, 5:41 AM
This revision now requires review to proceed.Dec 17 2021, 5:41 AM

Prevent eager minimization of not-to-be-minimized files.

This revision is now accepted and ready to land.Dec 20 2021, 10:33 AM
This revision was landed with ongoing or failed builds.Jan 21 2022, 4:05 AM
This revision was automatically updated to reflect the committed changes.