[llvm-commits] [llvm] r131004 - /llvm/trunk/utils/TableGen/TableGen.cpp

Jim Grosbach grosbach at apple.com
Fri May 6 11:39:28 PDT 2011


Author: grosbach
Date: Fri May  6 13:39:28 2011
New Revision: 131004

URL: http://llvm.org/viewvc/llvm-project?rev=131004&view=rev
Log:
ParseFile() may throw, so extend the try/catch to handle that.

Modified:
    llvm/trunk/utils/TableGen/TableGen.cpp

Modified: llvm/trunk/utils/TableGen/TableGen.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TableGen.cpp?rev=131004&r1=131003&r2=131004&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TableGen.cpp (original)
+++ llvm/trunk/utils/TableGen/TableGen.cpp Fri May  6 13:39:28 2011
@@ -228,19 +228,19 @@
   cl::ParseCommandLineOptions(argc, argv);
 
 
-  // Parse the input file.
-  if (ParseFile(InputFilename, IncludeDirs, SrcMgr, Records))
-    return 1;
-
-  std::string Error;
-  tool_output_file Out(OutputFilename.c_str(), Error);
-  if (!Error.empty()) {
-    errs() << argv[0] << ": error opening " << OutputFilename
-           << ":" << Error << "\n";
-    return 1;
-  }
-
   try {
+    // Parse the input file.
+    if (ParseFile(InputFilename, IncludeDirs, SrcMgr, Records))
+      return 1;
+
+    std::string Error;
+    tool_output_file Out(OutputFilename.c_str(), Error);
+    if (!Error.empty()) {
+      errs() << argv[0] << ": error opening " << OutputFilename
+        << ":" << Error << "\n";
+      return 1;
+    }
+
     switch (Action) {
     case PrintRecords:
       Out.os() << Records;           // No argument, dump all contents





More information about the llvm-commits mailing list