summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt/opt.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-08-18 08:43:06 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-08-18 08:43:06 +0000
commit713eedc1fbd52dd26d0aa92743985592aaa2e9b7 (patch)
treec688bcdc026af86c7d13edbd6b701817b086bf3d /llvm/tools/opt/opt.cpp
parent378f7d5d209b21eba24c8170a75777050a08fbe1 (diff)
downloadbcm5719-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/opt/opt.cpp')
-rw-r--r--llvm/tools/opt/opt.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index b67892bb34a..18b4a8c1574 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud