summaryrefslogtreecommitdiffstats
path: root/llvm/utils/FileUpdate/FileUpdate.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-20 16:54:27 +0000
committerDan Gohman <gohman@apple.com>2010-08-20 16:54:27 +0000
commitfe99020b479aa4d99941f3a36b3895ca3b2bd1a3 (patch)
treebd4d7749abd3f080f51d6edce144d25f40de71bb /llvm/utils/FileUpdate/FileUpdate.cpp
parent0600691fe66074d16a24cf159d47b7015b42c295 (diff)
downloadbcm5719-llvm-fe99020b479aa4d99941f3a36b3895ca3b2bd1a3.tar.gz
bcm5719-llvm-fe99020b479aa4d99941f3a36b3895ca3b2bd1a3.zip
Convert FileUpdate to use tool_output_file, and to use
errs() instead of outs() for its verbose messages. llvm-svn: 111648
Diffstat (limited to 'llvm/utils/FileUpdate/FileUpdate.cpp')
-rw-r--r--llvm/utils/FileUpdate/FileUpdate.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/utils/FileUpdate/FileUpdate.cpp b/llvm/utils/FileUpdate/FileUpdate.cpp
index 00c20915fc9..b97d9cf74e5 100644
--- a/llvm/utils/FileUpdate/FileUpdate.cpp
+++ b/llvm/utils/FileUpdate/FileUpdate.cpp
@@ -54,7 +54,7 @@ int main(int argc, char **argv) {
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 @@ int main(int argc, char **argv) {
// 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 @@ int main(int argc, char **argv) {
}
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;
}
OpenPOWER on IntegriCloud