Make sure to delete the output file if there is an error

llvm-svn: 7481
This commit is contained in:
Chris Lattner 2003-08-01 19:21:43 +00:00
parent 958f47b9f7
commit 74fa70bc51
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}