Changes in directory llvm/tools/llvm-as:
llvm-as.cpp updated: 1.46 -> 1.47 --- 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: (+3 -5) llvm-as.cpp | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) Index: llvm/tools/llvm-as/llvm-as.cpp diff -u llvm/tools/llvm-as/llvm-as.cpp:1.46 llvm/tools/llvm-as/llvm-as.cpp:1.47 --- llvm/tools/llvm-as/llvm-as.cpp:1.46 Thu Jul 6 13:01:01 2006 +++ llvm/tools/llvm-as/llvm-as.cpp Fri Aug 18 03:43:06 2006 @@ -57,9 +57,10 @@ std::ostream *Out = 0; try { // Parse the file now... - std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename)); + ParseError Err; + std::auto_ptr<Module> M(ParseAssemblyFile(InputFilename,&Err)); if (M.get() == 0) { - std::cerr << argv[0] << ": assembly didn't read correctly.\n"; + std::cerr << argv[0] << ": " << Err.getMessage() << "\n"; return 1; } @@ -129,9 +130,6 @@ if (Force || !CheckBytecodeOutputToConsole(Out,true)) { WriteBytecodeToFile(M.get(), *Out, !NoCompress); } - } catch (const ParseException &E) { - std::cerr << argv[0] << ": " << E.getMessage() << "\n"; - exitCode = 1; } catch (const std::string& msg) { std::cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits