Use the presence of the llvmcache.timestamp file to mark a directory as a
cache directory. Only prune the cache if the file exists. The idea is to
protect against data loss if the user supplies an incorrect cache directory.
Details
- Reviewers
mehdi_amini
Diff Detail
- Build Status
Buildable 4847 Build 4847: arc lint + arc unit
Event Timeline
I believe this approach is too fragile, in particular because if llvmcache.timestamp is deleted, the cache no longer works, but the directory exists. That creates a broken state and user will have to learn about how the cache works. That breaks the principle of least surprise.
It would be a major problem, if it gets broken on a bot where no easy access to the filesystem exists.
Also, this approach makes tests cumbersome, as we can see in this CL.
lld/test/ELF/lto/cache.ll | ||
---|---|---|
18 | Why is -R needed? |
Ivan suggested that we can just use a hidden directory inside the user-supplied directory as the cache directory. I like that approach better, so I'm abandoning this.
The idea is to protect against data loss if the user supplies an incorrect cache directory.
I can see this "user" as "user of the API", but it is not clear to me as a "user of the linker" since the timestamp is automatically added.
Not sure how it'll look like...
What about pattern-matching the list of files to see if any don't have the expected name structure? The linker could warn (or error) when supplied such a directory as cache).
Thinking about it a little more, that does seem a little less surprising. We can require all files to have the prefix llvmcache- or something.
Why is -R needed?