mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Convert tablegen to use tool_output_file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111644 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5d56d9df92
commit
cec358ae16
@ -216,16 +216,13 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
|
||||
std::string Error;
|
||||
raw_fd_ostream Out(OutputFilename.c_str(), Error);
|
||||
tool_output_file Out(OutputFilename.c_str(), Error);
|
||||
if (!Error.empty()) {
|
||||
errs() << argv[0] << ": error opening " << OutputFilename
|
||||
<< ":" << Error << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Make sure the file gets removed if *gasp* tablegen crashes...
|
||||
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
||||
|
||||
try {
|
||||
switch (Action) {
|
||||
case PrintRecords:
|
||||
@ -339,6 +336,8 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Declare success.
|
||||
Out.keep();
|
||||
return 0;
|
||||
|
||||
} catch (const TGError &Error) {
|
||||
@ -353,7 +352,5 @@ int main(int argc, char **argv) {
|
||||
errs() << argv[0] << ": Unknown unexpected exception occurred.\n";
|
||||
}
|
||||
|
||||
if (OutputFilename != "-")
|
||||
std::remove(OutputFilename.c_str()); // Remove the file, it's broken
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user