This is a follow-up to https://reviews.llvm.org/D131624 (specifically to https://reviews.llvm.org/D131624#3716584)
Details
- Reviewers
ributzka thakis steven_wu - Group Reviewers
Restricted Project - Commits
- rGa5764912fb48: [lld-macho] Hardlink -object_path_lto files to cache when possible
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Cool, thanks!
Should we try to test this? Say, with a REQUIRES: shell line (to rule out Windows which can't hardlink files without admin) and ls -l somefile | cut -f 3 -d ' ' and check that this link count is 2?
lld/MachO/LTO.cpp | ||
---|---|---|
60 | nit: To make it more clear that this isn't a function that returns a success bool, I'd write this as: autor err = fs::create_hard_link(*originalPath, path); if (!err) return; (I assumed create_hard_link returns true on success and false on failure and the wondered why we'd return on failure here.) |
(to rule out Windows which can't hardlink files without admin)
IIRC Windows can create hard links without admin. It's symbolic links which require admin (until developer mode on Windows 10).
Added test. For some reason, I thought it was less practical than it ended up being, thanks for the suggestion.
I guess the Windows thing is a moot point either way since this test already has`UNSUPPORTED: system-windows`
LGTM. Small comment inline.
lld/test/MachO/lto-object-path.ll | ||
---|---|---|
26 | Would be good to add a short comment about what this is testing. It is not obvious that you are reading the number of links field from ls long format. |
nit: To make it more clear that this isn't a function that returns a success bool, I'd write this as:
(I assumed create_hard_link returns true on success and false on failure and the wondered why we'd return on failure here.)