[ThinLTO] Also prune Thin-* files from the ThinLTO cache
authorHans Wennborg <hans@chromium.org>
Tue, 19 Jan 2021 12:41:41 +0000 (13:41 +0100)
committerHans Wennborg <hans@chromium.org>
Tue, 19 Jan 2021 13:43:49 +0000 (14:43 +0100)
commitec877106a38b760229a2d676b7d2278b2bade8ab
treed6efd301d2a21371c71564bd4627c55d6317bc7a
parent1d37db6ef53db453534b9edfcc6a58c4f4f5c914
[ThinLTO] Also prune Thin-* files from the ThinLTO cache

Such files (Thin-%%%%%%.tmp.o) are supposed to be deleted immediately
after they're used (either by renaming or deletion). However, we've seen
instances on Windows where this doesn't happen, probably due to the
filesystem being flaky. This is effectively a resource leak which has
prevented us from using the ThinLTO cache on Windows.

Since those temporary files are in the thinlto cache directory which we
prune periodically anyway, allowing them to be pruned too seems like a
tidy way to solve the problem.

Differential revision: https://reviews.llvm.org/D94962
lld/test/COFF/lto-cache.ll
llvm/lib/Support/CachePruning.cpp