Just a utility function used in i-w-b.
Details
Diff Detail
Event Timeline
clang/lib/IndexSerialization/FSUtil.h | ||
---|---|---|
27 ↗ | (On Diff #217562) | "writeFileAtomically" |
28 ↗ | (On Diff #217562) | Please use StringRef instead of SmallString. |
29 ↗ | (On Diff #217562) | Why not llvm::Error? |
35 ↗ | (On Diff #217562) | failed to create a temporary file with model '...' Traditionally after a colon one would write the reason why the operation failed, like "not enough space on disk" |
62 ↗ | (On Diff #217562) | Why not put it into llvm/Support/FileUtilities.h? |
Hmm, actually if we replace Buffer in the interface with a llvm::function_ref<void(llvm::raw_ostream &)> callback it would cover couple other existing uses of createUniqueFile.
That would make a lot of sense if you're going to do the cleanup and refactor those callers to use new API. Good idea!
However, I think just from the API simplicity perspective, it would make sense to have two overloaded APIs if calling this function with a precomputed buffer is common.
Sorry for the late addition to the review, but any chance this API could have a unit test? Of course we can't test the automicity, but basic end to end flow on the "happy path" would be nice to test.
Ok. I'll land this simple version first and will take a look at the overload next week.