I noticed there are couple other implementations of atomic file write and replaced these with shared implementation.
I have to admit my enthusiasm for factoring this out waned a bit after I added proper error handling in lldb-platform and ThinLTOCodeGenerator as it doesn't look all that simpler than current code.
(Maybe I'm holding it wrong?) Open to suggestions.
Details
Details
- Reviewers
gribozavr JDevlieghere davide tejohnson steven_wu - Commits
- rCTE371890: [Support] Add overload writeFileAtomically(std::function Writer)
rGf69c91780fbb: [Support] Add overload writeFileAtomically(std::function Writer)
rL371890: [Support] Add overload writeFileAtomically(std::function Writer)
rC371890: [Support] Add overload writeFileAtomically(std::function Writer)
rLLDB371890: [Support] Add overload writeFileAtomically(std::function Writer)
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Thanks Jan, I think this is a great improvement. IMHO the fact that we can share code outweighs the slightly increased complexity.
llvm/include/llvm/Support/FileUtilities.h | ||
---|---|---|
107 ↗ | (On Diff #219637) | I wonder if the temp path should be configurable or at least make it a default argument. Removing that would definitely make the call sites a little simpler. At least for LLDB I don't think the temp path matters. |
llvm/include/llvm/Support/FileUtilities.h | ||
---|---|---|
107 ↗ | (On Diff #219637) | Of course, good point! I'll create a separate patch. |