mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
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
This commit is contained in:
parent
2d16f5b0cb
commit
7a4575e26e
@ -54,7 +54,7 @@ int main(int argc, char **argv) {
|
|||||||
memcmp(In->getBufferStart(), Out->getBufferStart(),
|
memcmp(In->getBufferStart(), Out->getBufferStart(),
|
||||||
Out->getBufferSize()) == 0) {
|
Out->getBufferSize()) == 0) {
|
||||||
if (!Quiet)
|
if (!Quiet)
|
||||||
outs() << argv[0] << ": Not updating '" << OutputFilename
|
errs() << argv[0] << ": Not updating '" << OutputFilename
|
||||||
<< "', contents match input.\n";
|
<< "', contents match input.\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Otherwise, overwrite the output.
|
// Otherwise, overwrite the output.
|
||||||
if (!Quiet)
|
if (!Quiet)
|
||||||
outs() << argv[0] << ": Updating '" << OutputFilename
|
errs() << argv[0] << ": Updating '" << OutputFilename
|
||||||
<< "', contents changed.\n";
|
<< "', contents changed.\n";
|
||||||
raw_fd_ostream OutStream(OutputFilename.c_str(), ErrorStr,
|
tool_output_file OutStream(OutputFilename.c_str(), ErrorStr,
|
||||||
raw_fd_ostream::F_Binary);
|
raw_fd_ostream::F_Binary);
|
||||||
if (!ErrorStr.empty()) {
|
if (!ErrorStr.empty()) {
|
||||||
errs() << argv[0] << ": Unable to write output '"
|
errs() << argv[0] << ": Unable to write output '"
|
||||||
<< OutputFilename << "': " << ErrorStr << '\n';
|
<< OutputFilename << "': " << ErrorStr << '\n';
|
||||||
@ -74,14 +74,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OutStream.write(In->getBufferStart(), In->getBufferSize());
|
OutStream.write(In->getBufferStart(), In->getBufferSize());
|
||||||
OutStream.close();
|
|
||||||
|
|
||||||
if (OutStream.has_error()) {
|
// Declare success.
|
||||||
errs() << argv[0] << ": Could not open output file '"
|
OutStream.keep();
|
||||||
<< OutputFilename << "': " << ErrorStr << '\n';
|
|
||||||
OutStream.clear_error();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user