[lld] r326281 - [WebAssembly] Do not remove existing output file.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 27 16:33:59 PST 2018
Author: ruiu
Date: Tue Feb 27 16:33:59 2018
New Revision: 326281
URL: http://llvm.org/viewvc/llvm-project?rev=326281&view=rev
Log:
[WebAssembly] Do not remove existing output file.
FileOutputBuffer automatically removes an existing file, so we don't
need to do that. Actually doing that is discouraged because when the
linker fails to create an output for some reason after instantiating
FileOutputBufffer, FileOutputBuffer removes a temporary file and don't
touch an existing file. That's an desired behavior from the user's
point of view.
(Internally, FileOutputBuffer writes its contents to a temporary file
and then rename it over to an existing file on commit()).
Differential Revision: https://reviews.llvm.org/D43728
Modified:
lld/trunk/wasm/Writer.cpp
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=326281&r1=326280&r2=326281&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Tue Feb 27 16:33:59 2018
@@ -964,7 +964,6 @@ void Writer::run() {
// Open a result file.
void Writer::openFile() {
log("writing: " + Config->OutputFile);
- ::remove(Config->OutputFile.str().c_str());
Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
FileOutputBuffer::create(Config->OutputFile, FileSize,
More information about the llvm-commits
mailing list