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 | 61c83e023fe618ca7b4fdc846039933e61a00ec9 (patch) | |
tree | e491ad2dc8f630614952fa612f602a39c34bed1e /tools/opt/opt.cpp | |
parent | fd90dd5d5513f9e7130bab0da334ad2ad8ef4e02 (diff) | |
download | external_llvm-61c83e023fe618ca7b4fdc846039933e61a00ec9.zip external_llvm-61c83e023fe618ca7b4fdc846039933e61a00ec9.tar.gz external_llvm-61c83e023fe618ca7b4fdc846039933e61a00ec9.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r-- | tools/opt/opt.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index b67892b..18b4a8c 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -169,17 +169,13 @@ int main(int argc, char **argv) { 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; } |