From: Chris Lattner Date: Fri, 1 Aug 2003 19:21:43 +0000 (+0000) Subject: Make sure to delete the output file if there is an error X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f1e366acffbe4bdbb1d4a573c178f5531efdf7f8;p=oota-llvm.git Make sure to delete the output file if there is an error git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7481 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/support/tools/TableGen/TableGen.cpp b/support/tools/TableGen/TableGen.cpp index 4b0cd9d2a33..088dcbe0e39 100644 --- a/support/tools/TableGen/TableGen.cpp +++ b/support/tools/TableGen/TableGen.cpp @@ -431,7 +431,10 @@ int main(int argc, char **argv) { } } catch (const std::string &Error) { std::cerr << Error << "\n"; - if (Out != &std::cout) delete Out; + if (Out != &std::cout) { + delete Out; // Close the file + std::remove(OutputFilename.c_str()); // Remove the file, it's broken + } return 1; } diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index 4b0cd9d2a33..088dcbe0e39 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -431,7 +431,10 @@ int main(int argc, char **argv) { } } catch (const std::string &Error) { std::cerr << Error << "\n"; - if (Out != &std::cout) delete Out; + if (Out != &std::cout) { + delete Out; // Close the file + std::remove(OutputFilename.c_str()); // Remove the file, it's broken + } return 1; }