From 2a16a5fae578ffd07a17ea6889d96bc8b9587670 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sat, 14 May 2016 04:58:38 +0000 Subject: [PATCH] ThinLTOCodeGenerator: handle std::error_code instead of silently dropping it. From: Mehdi Amini llvm-svn: 269541 --- llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 93a3f3e84ad0..b57166d65abe 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -502,7 +502,11 @@ public: OS << OutputBuffer.getBuffer(); } // Rename to final destination (hopefully race condition won't matter here) - sys::fs::rename(TempFilename, EntryPath); + 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); + } } };