[llvm-commits] [llvm] r111648 - /llvm/trunk/utils/FileUpdate/FileUpdate.cpp
Dan Gohman
gohman at apple.com
Fri Aug 20 09:54:27 PDT 2010
Author: djg
Date: Fri Aug 20 11:54:27 2010
New Revision: 111648
URL: http://llvm.org/viewvc/llvm-project?rev=111648&view=rev
Log:
Convert FileUpdate to use tool_output_file, and to use
errs() instead of outs() for its verbose messages.
Modified:
llvm/trunk/utils/FileUpdate/FileUpdate.cpp
Modified: llvm/trunk/utils/FileUpdate/FileUpdate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileUpdate/FileUpdate.cpp?rev=111648&r1=111647&r2=111648&view=diff
==============================================================================
--- llvm/trunk/utils/FileUpdate/FileUpdate.cpp (original)
+++ llvm/trunk/utils/FileUpdate/FileUpdate.cpp Fri Aug 20 11:54:27 2010
@@ -54,7 +54,7 @@
memcmp(In->getBufferStart(), Out->getBufferStart(),
Out->getBufferSize()) == 0) {
if (!Quiet)
- outs() << argv[0] << ": Not updating '" << OutputFilename
+ errs() << argv[0] << ": Not updating '" << OutputFilename
<< "', contents match input.\n";
return 0;
}
@@ -63,10 +63,10 @@
// Otherwise, overwrite the output.
if (!Quiet)
- outs() << argv[0] << ": Updating '" << OutputFilename
+ errs() << argv[0] << ": Updating '" << OutputFilename
<< "', contents changed.\n";
- raw_fd_ostream OutStream(OutputFilename.c_str(), ErrorStr,
- raw_fd_ostream::F_Binary);
+ tool_output_file OutStream(OutputFilename.c_str(), ErrorStr,
+ raw_fd_ostream::F_Binary);
if (!ErrorStr.empty()) {
errs() << argv[0] << ": Unable to write output '"
<< OutputFilename << "': " << ErrorStr << '\n';
@@ -74,14 +74,9 @@
}
OutStream.write(In->getBufferStart(), In->getBufferSize());
- OutStream.close();
- if (OutStream.has_error()) {
- errs() << argv[0] << ": Could not open output file '"
- << OutputFilename << "': " << ErrorStr << '\n';
- OutStream.clear_error();
- return 1;
- }
+ // Declare success.
+ OutStream.keep();
return 0;
}
More information about the llvm-commits
mailing list