[llvm-commits] CVS: llvm/tools/bugpoint/BugDriver.cpp

Reid Spencer reid at x10sys.com
Fri Aug 18 01:43:27 PDT 2006



Changes in directory llvm/tools/bugpoint:

BugDriver.cpp updated: 1.47 -> 1.48
---
Log message:

For PR797: http://llvm.org/PR797 :
Rid the Assembly Parser of exceptions. This is a really gross hack but it
will do until the Assembly Parser is re-written as a recursive descent.
The basic premise is that wherever the old "ThrowException" function was
called (new name: GenerateError) we set a flag (TriggerError). Every
production checks that flag and calls YYERROR if it is set. Additionally,
each call to ThrowException in the grammar is replaced with GEN_ERROR 
which calls GenerateError and then YYERROR immediately. This prevents
the remaining production from continuing after an error condition.


---
Diffs of the changes:  (+4 -9)

 BugDriver.cpp |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)


Index: llvm/tools/bugpoint/BugDriver.cpp
diff -u llvm/tools/bugpoint/BugDriver.cpp:1.47 llvm/tools/bugpoint/BugDriver.cpp:1.48
--- llvm/tools/bugpoint/BugDriver.cpp:1.47	Tue Aug 15 11:40:49 2006
+++ llvm/tools/bugpoint/BugDriver.cpp	Fri Aug 18 03:43:06 2006
@@ -73,15 +73,10 @@
 /// return it, or return null if not possible.
 ///
 Module *llvm::ParseInputFile(const std::string &InputFilename) {
-  Module *Result = 0;
-  try {
-    Result = ParseBytecodeFile(InputFilename);
-    if (!Result && !(Result = ParseAssemblyFile(InputFilename))){
-      std::cerr << "bugpoint: could not read input file '"
-                << InputFilename << "'!\n";
-    }
-  } catch (const ParseException &E) {
-    std::cerr << "bugpoint: " << E.getMessage() << '\n';
+  ParseError Err;
+  Module *Result = ParseBytecodeFile(InputFilename);
+  if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
+    std::cerr << "bugpoint: " << Err.getMessage() << "\n"; 
     Result = 0;
   }
   return Result;






More information about the llvm-commits mailing list