diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2010-04-12 05:08:25 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2010-04-12 05:08:25 +0000 |
commit | 22ff748712b348300e51248339b6e8cf9b59e2c6 (patch) | |
tree | ab07a4e3d46ed34d8f3510ed11ea772016bca4bd /tools/bugpoint/FindBugs.cpp | |
parent | 67a71b5306c42f1d56a0d58635432b86206c2a9a (diff) | |
download | external_llvm-22ff748712b348300e51248339b6e8cf9b59e2c6.zip external_llvm-22ff748712b348300e51248339b6e8cf9b59e2c6.tar.gz external_llvm-22ff748712b348300e51248339b6e8cf9b59e2c6.tar.bz2 |
Remove use of exceptions from bugpoint. No deliberate functionality change!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/FindBugs.cpp')
-rw-r--r-- | tools/bugpoint/FindBugs.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/tools/bugpoint/FindBugs.cpp b/tools/bugpoint/FindBugs.cpp index b27a25c..224c717 100644 --- a/tools/bugpoint/FindBugs.cpp +++ b/tools/bugpoint/FindBugs.cpp @@ -29,7 +29,8 @@ using namespace llvm; /// If the passes did not compile correctly, output the command required to /// recreate the failure. This returns true if a compiler error is found. /// -bool BugDriver::runManyPasses(const std::vector<const PassInfo*> &AllPasses) { +bool BugDriver::runManyPasses(const std::vector<const PassInfo*> &AllPasses, + std::string &ErrMsg) { setPassesToRun(AllPasses); outs() << "Starting bug finding procedure...\n\n"; @@ -74,33 +75,33 @@ bool BugDriver::runManyPasses(const std::vector<const PassInfo*> &AllPasses) { // Step 3: Compile the optimized code. // outs() << "Running the code generator to test for a crash: "; - try { - compileProgram(Program); - outs() << '\n'; - } catch (ToolExecutionError &TEE) { + std::string Error; + compileProgram(Program, &Error); + if (!Error.empty()) { outs() << "\n*** compileProgram threw an exception: "; - outs() << TEE.what(); - return debugCodeGeneratorCrash(); + outs() << Error; + return debugCodeGeneratorCrash(ErrMsg); } + outs() << '\n'; // // Step 4: Run the program and compare its output to the reference // output (created above). // outs() << "*** Checking if passes caused miscompliation:\n"; - try { - if (diffProgram(Filename, "", false)) { - outs() << "\n*** diffProgram returned true!\n"; - debugMiscompilation(); + bool Diff = diffProgram(Filename, "", false, &Error); + if (Error.empty() && Diff) { + outs() << "\n*** diffProgram returned true!\n"; + debugMiscompilation(&Error); + if (Error.empty()) return true; - } else { - outs() << "\n*** diff'd output matches!\n"; - } - } catch (ToolExecutionError &TEE) { - errs() << TEE.what(); - debugCodeGeneratorCrash(); + } + if (!Error.empty()) { + errs() << Error; + debugCodeGeneratorCrash(ErrMsg); return true; } + outs() << "\n*** diff'd output matches!\n"; sys::Path(Filename).eraseFromDisk(); |