[PATCH] D37410: LTO: Try to open cache files before renaming them.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 12:55:24 PDT 2017


pcc added a comment.

In https://reviews.llvm.org/D37410#859518, @zturner wrote:

> I think you actually can rename open files on Windows.  Or at least, you can try to.  I'll have to dig in when I have a bit more time though to see if there's any weird things we need to be aware of when doing it, or casse where it won't work.
>
> But basically, what you do is call `SetFileInformationByHandle` and set the `FileInformationClass` parameter to `FileRenameInfo`, and fill out a `FILE_RENAME_INFO` structure to pass for the 3rd argument.


Thanks, I've left a FIXME about renaming the file in the way you've suggested.



================
Comment at: llvm/include/llvm/LTO/Caching.h:27
 ///
-/// MB->getBufferIdentifier() is a valid path for the file at the time that it
-/// was opened, but clients should prefer to access MB directly in order to
-/// avoid a potential race condition.
+/// Path is a valid path for the file at the time that it was opened, but
+/// clients should prefer to access MB directly in order to avoid a potential
----------------
mehdi_amini wrote:
> The comment is not accurate I believe: the `Path` didn't exist when when the memory buffer was created, and it was never opened using this path.
Reworded this comment.


https://reviews.llvm.org/D37410





More information about the llvm-commits mailing list