diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-20 16:45:58 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-20 16:45:58 +0000 |
commit | cec358ae167464e7c5a382ea008c3e369be136f3 (patch) | |
tree | 544dd8aa245b790b1390267369b8cf9c1fe978f1 /utils | |
parent | 5d56d9df928c48571980efe8d4205de8ab557b7c (diff) | |
download | external_llvm-cec358ae167464e7c5a382ea008c3e369be136f3.zip external_llvm-cec358ae167464e7c5a382ea008c3e369be136f3.tar.gz external_llvm-cec358ae167464e7c5a382ea008c3e369be136f3.tar.bz2 |
Convert tablegen to use tool_output_file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/TableGen.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index 30e4d0f..a544e1d 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -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; } |