summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--support/tools/TableGen/TableGen.cpp5
-rw-r--r--utils/TableGen/TableGen.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/support/tools/TableGen/TableGen.cpp b/support/tools/TableGen/TableGen.cpp
index 4b0cd9d2a3..088dcbe0e3 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 4b0cd9d2a3..088dcbe0e3 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;
}