[PATCH] D39993: Remove dead code

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 17:49:58 PST 2017


rafael created this revision.
Herald added a subscriber: mehdi_amini.

I think this code is dead since rename was reimplemented on windows in r315079.


https://reviews.llvm.org/D39993

Files:
  lib/LTO/Caching.cpp


Index: lib/LTO/Caching.cpp
===================================================================
--- lib/LTO/Caching.cpp
+++ lib/LTO/Caching.cpp
@@ -71,20 +71,7 @@
                              TempFilename + ": " +
                              MBOrErr.getError().message() + "\n");
 
-        // This is atomic on POSIX systems.
-        // On Windows, it can fail with permission denied if the destination
-        // file already exists. Since the existing file should be semantically
-        // equivalent to the one we are trying to write, we give AddBuffer
-        // a copy of the bytes we wrote in that case. We do this instead of
-        // just using the existing file, because the pruner might delete the
-        // file before we get a chance to use it.
-        auto EC = sys::fs::rename(TempFilename, EntryPath);
-        if (EC == errc::permission_denied) {
-          auto MBCopy = MemoryBuffer::getMemBufferCopy(
-              (*MBOrErr)->getBuffer(), EntryPath);
-          MBOrErr = std::move(MBCopy);
-          sys::fs::remove(TempFilename);
-        } else if (EC) {
+        if (auto EC = sys::fs::rename(TempFilename, EntryPath)) {
           report_fatal_error(Twine("Failed to rename temporary file ") +
                              TempFilename + " to " + EntryPath + ": " +
                              EC.message() + "\n");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39993.122759.patch
Type: text/x-patch
Size: 1359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171114/76ef1ba1/attachment.bin>


More information about the llvm-commits mailing list