[PATCH] D42326: [COFF] add option to avoid overwriting unchanged import libraries

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 17:47:56 PST 2018


inglorion marked 6 inline comments as done.
inglorion added inline comments.


================
Comment at: lld/COFF/Driver.cpp:558
+        if ((*OldBuf)->getBuffer() != NewBuf->getBuffer()) {
+          OldBuf->reset();
+          auto EC = sys::fs::rename(TmpName, Path);
----------------
ruiu wrote:
> Do you have to call `reset`?
I think we need it, yes. This is to close the file that we just opened, so that rename can replace it.

See also similar code at the end of writeArchive() in  llvm/lib/Object/ArchiveWriter.cpp, and the comment there.



https://reviews.llvm.org/D42326





More information about the llvm-commits mailing list