From 61c83e023fe618ca7b4fdc846039933e61a00ec9 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Fri, 18 Aug 2006 08:43:06 +0000 Subject: 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 --- tools/bugpoint/BugDriver.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'tools/bugpoint/BugDriver.cpp') diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index 9d82e8b3cc..e499477630 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -73,15 +73,10 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, /// return it, or return null if not possible. /// Module *llvm::ParseInputFile(const std::string &InputFilename) { - Module *Result = 0; - try { - Result = ParseBytecodeFile(InputFilename); - if (!Result && !(Result = ParseAssemblyFile(InputFilename))){ - std::cerr << "bugpoint: could not read input file '" - << InputFilename << "'!\n"; - } - } catch (const ParseException &E) { - std::cerr << "bugpoint: " << E.getMessage() << '\n'; + ParseError Err; + Module *Result = ParseBytecodeFile(InputFilename); + if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) { + std::cerr << "bugpoint: " << Err.getMessage() << "\n"; Result = 0; } return Result; -- cgit v1.2.3