diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index b57166d65ab..33d0a0cd920 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -504,8 +504,12 @@ public: // Rename to final destination (hopefully race condition won't matter here) EC = sys::fs::rename(TempFilename, EntryPath); if (EC) { - errs() << "Error: " << EC.message() << "\n"; - report_fatal_error("ThinLTO: Can't rename temporary file " + TempFilename + " to " + EntryPath); + sys::fs::remove(TempFilename); + raw_fd_ostream OS(EntryPath, EC, sys::fs::F_None); + if (EC) + report_fatal_error(Twine("Failed to open ") + EntryPath + + " to save cached entry\n"); + OS << OutputBuffer.getBuffer(); } } }; |

