diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-20 16:54:27 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-20 16:54:27 +0000 |
commit | 7a4575e26e58da743cf6c921aadd0d5499717a68 (patch) | |
tree | fcefe2fae5ba051c53f97cf700594752616177d6 /utils/FileUpdate | |
parent | 2d16f5b0cb5ae03c4b4ff6711d543552d97243a0 (diff) |
Convert FileUpdate to use tool_output_file, and to use
errs() instead of outs() for its verbose messages.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/FileUpdate')
-rw-r--r-- | utils/FileUpdate/FileUpdate.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/utils/FileUpdate/FileUpdate.cpp b/utils/FileUpdate/FileUpdate.cpp index 00c20915fc..b97d9cf74e 100644 --- a/utils/FileUpdate/FileUpdate.cpp +++ b/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; } |