diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-08-18 08:43:06 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-08-18 08:43:06 +0000 |
commit | 713eedc1fbd52dd26d0aa92743985592aaa2e9b7 (patch) | |
tree | c688bcdc026af86c7d13edbd6b701817b086bf3d /llvm/tools/llvm-as | |
parent | 378f7d5d209b21eba24c8170a75777050a08fbe1 (diff) | |
download | bcm5719-llvm-713eedc1fbd52dd26d0aa92743985592aaa2e9b7.tar.gz bcm5719-llvm-713eedc1fbd52dd26d0aa92743985592aaa2e9b7.zip |
For 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.
llvm-svn: 29763
Diffstat (limited to 'llvm/tools/llvm-as')
-rw-r--r-- | llvm/tools/llvm-as/llvm-as.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp index 9547ad13e25..4a1b9adb003 100644 --- a/llvm/tools/llvm-as/llvm-as.cpp +++ b/llvm/tools/llvm-as/llvm-as.cpp @@ -57,9 +57,10 @@ int main(int argc, char **argv) { 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 @@ int main(int argc, char **argv) { 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; |