[llvm-commits] [llvm] r163349 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp
Bill Wendling
isanbard at gmail.com
Thu Sep 6 14:07:57 PDT 2012
Author: void
Date: Thu Sep 6 16:07:57 2012
New Revision: 163349
URL: http://llvm.org/viewvc/llvm-project?rev=163349&view=rev
Log:
Explicitly erase the file from disk if something bad happened. <rdar://problem/12184899>
Modified:
llvm/trunk/tools/lto/LTOCodeGenerator.cpp
Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=163349&r1=163348&r2=163349&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Sep 6 16:07:57 2012
@@ -163,13 +163,16 @@
// generate object file
bool genResult = false;
tool_output_file objFile(uniqueObjPath.c_str(), errMsg);
- if (!errMsg.empty())
+ if (!errMsg.empty()) {
+ uniqueObjPath.eraseFromDisk();
return true;
+ }
genResult = this->generateObjectFile(objFile.os(), errMsg);
objFile.os().close();
if (objFile.os().has_error()) {
objFile.os().clear_error();
+ uniqueObjPath.eraseFromDisk();
return true;
}
@@ -196,6 +199,7 @@
OwningPtr<MemoryBuffer> BuffPtr;
if (error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
errMsg = ec.message();
+ sys::Path(_nativeObjectPath).eraseFromDisk();
return NULL;
}
_nativeObjectFile = BuffPtr.take();
More information about the llvm-commits
mailing list