[llvm-commits] CVS: llvm/tools/opt/opt.cpp

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



Changes in directory llvm/tools/opt:

opt.cpp updated: 1.111 -> 1.112
---
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:  (+5 -9)

 opt.cpp |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)


Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.111 llvm/tools/opt/opt.cpp:1.112
--- llvm/tools/opt/opt.cpp:1.111	Fri Aug 18 01:34:30 2006
+++ llvm/tools/opt/opt.cpp	Fri Aug 18 03:43:06 2006
@@ -169,17 +169,13 @@
 
     if (AnalyzeOnly) {
       Module *CurMod = 0;
-      try {
 #if 0
-        TimeRegion RegionTimer(BytecodeLoadTimer);
+      TimeRegion RegionTimer(BytecodeLoadTimer);
 #endif
-        CurMod = ParseBytecodeFile(InputFilename);
-        if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename))){
-          std::cerr << argv[0] << ": input file didn't read correctly.\n";
-          return 1;
-        }
-      } catch (const ParseException &E) {
-        std::cerr << argv[0] << ": " << E.getMessage() << "\n";
+      CurMod = ParseBytecodeFile(InputFilename);
+      ParseError Err;
+      if (!CurMod && !(CurMod = ParseAssemblyFile(InputFilename,&Err))){
+        std::cerr << argv[0] << ": " << Err.getMessage() << "\n"; 
         return 1;
       }
 






More information about the llvm-commits mailing list