diff --git a/llvm/utils/TableGen/TableGen.cpp b/llvm/utils/TableGen/TableGen.cpp index d6e84609f430..c6692f805bac 100644 --- a/llvm/utils/TableGen/TableGen.cpp +++ b/llvm/utils/TableGen/TableGen.cpp @@ -212,6 +212,13 @@ int main(int argc, char **argv) { std::remove(OutputFilename.c_str()); // Remove the file, it's broken } return 1; + } catch (const char *Error) { + cerr << argv[0] << ": " << Error << "\n"; + if (Out != cout.stream()) { + delete Out; // Close the file + std::remove(OutputFilename.c_str()); // Remove the file, it's broken + } + return 1; } catch (...) { cerr << argv[0] << ": Unknown unexpected exception occurred.\n"; if (Out != cout.stream()) {