Make tblgen's exception handling a little more robust by printing the
authorReid Spencer <rspencer@reidspencer.com>
Fri, 3 Sep 2004 23:17:54 +0000 (23:17 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Fri, 3 Sep 2004 23:17:54 +0000 (23:17 +0000)
program name and also catching ...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16160 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/TableGen.cpp

index 15b313191e5c93238e11b4de932218f95f03bb9e..5c0f91a9fe813596e48f0c35da39609c2ca03df3 100644 (file)
@@ -478,12 +478,19 @@ int main(int argc, char **argv) {
       return 1;
     }
   } catch (const std::string &Error) {
-    std::cerr << Error << "\n";
+    std::cerr << argv[0] << ": " << Error << "\n";
     if (Out != &std::cout) {
       delete Out;                             // Close the file
       std::remove(OutputFilename.c_str());    // Remove the file, it's broken
     }
     return 1;
+  } catch (...) {
+    std::cerr << argv[0] << ": Unknown unexpected exception occurred.\n";
+    if (Out != &std::cout) {
+      delete Out;                             // Close the file
+      std::remove(OutputFilename.c_str());    // Remove the file, it's broken
+    }
+    return 2;
   }
 
   if (Out != &std::cout) {