diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-19 07:39:26 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-19 07:39:26 +0000 |
commit | 3562c2dd9fd8b82432b6bc682ef92ace785f940f (patch) | |
tree | 99a3b3087ddf39bcfe1ef636b8dca3f3d817f0c3 /llvm | |
parent | c94edd6cdee4f3a51ae42be6e3cb6c585271c8be (diff) | |
download | bcm5719-llvm-3562c2dd9fd8b82432b6bc682ef92ace785f940f.tar.gz bcm5719-llvm-3562c2dd9fd8b82432b6bc682ef92ace785f940f.zip |
Make ToolExecutionError inherit std::exception and implement its
interface: getMessage() is gone, use what() instead.
llvm-svn: 11621
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Support/ToolRunner.h | 8 | ||||
-rw-r--r-- | llvm/lib/Support/ToolRunner.cpp | 2 | ||||
-rw-r--r-- | llvm/tools/bugpoint/BugDriver.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/bugpoint/bugpoint.cpp | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/llvm/include/llvm/Support/ToolRunner.h b/llvm/include/llvm/Support/ToolRunner.h index d8e7503253f..9cbbf7f51e0 100644 --- a/llvm/include/llvm/Support/ToolRunner.h +++ b/llvm/include/llvm/Support/ToolRunner.h @@ -18,6 +18,7 @@ #define TOOLRUNNER_H #include "Support/SystemUtils.h" +#include <exception> #include <vector> namespace llvm { @@ -30,11 +31,12 @@ class LLC; /// AbstractInterpreter instances if there is an error running a tool (e.g., LLC /// crashes) which prevents execution of the program. /// -class ToolExecutionError { +class ToolExecutionError : std::exception { std::string Message; public: - ToolExecutionError(const std::string &M) : Message(M) {} - const std::string getMessage() const { return Message; } + explicit ToolExecutionError(const std::string &M) : Message(M) {} + virtual ~ToolExecutionError() throw(); + virtual const char* what() const throw() { return Message.c_str(); } }; diff --git a/llvm/lib/Support/ToolRunner.cpp b/llvm/lib/Support/ToolRunner.cpp index 6ad3d4392c0..4a7be56461a 100644 --- a/llvm/lib/Support/ToolRunner.cpp +++ b/llvm/lib/Support/ToolRunner.cpp @@ -21,6 +21,8 @@ #include <sstream> using namespace llvm; +ToolExecutionError::~ToolExecutionError() throw() { } + static void ProcessFailure(std::string ProgPath, const char** Args) { std::ostringstream OS; OS << "\nError running tool:\n "; diff --git a/llvm/tools/bugpoint/BugDriver.cpp b/llvm/tools/bugpoint/BugDriver.cpp index 4359622777f..d3a57f4afe2 100644 --- a/llvm/tools/bugpoint/BugDriver.cpp +++ b/llvm/tools/bugpoint/BugDriver.cpp @@ -159,7 +159,7 @@ bool BugDriver::run() { CreatedOutput = true; std::cout << "Reference output is: " << ReferenceOutputFile << "\n"; } catch (ToolExecutionError &TEE) { - std::cerr << TEE.getMessage(); + std::cerr << TEE.what(); if (Interpreter != cbe) { std::cerr << "*** There is a bug running the C backend. Either debug" << " it (use the -run-cbe bugpoint option), or fix the error" @@ -183,7 +183,7 @@ bool BugDriver::run() { return debugMiscompilation(); } } catch (ToolExecutionError &TEE) { - std::cerr << TEE.getMessage(); + std::cerr << TEE.what(); return debugCodeGeneratorCrash(); } diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp index 3c89dce525a..65de9658a7e 100644 --- a/llvm/tools/bugpoint/bugpoint.cpp +++ b/llvm/tools/bugpoint/bugpoint.cpp @@ -54,7 +54,7 @@ int main(int argc, char **argv) { try { return D.run(); } catch (ToolExecutionError &TEE) { - std::cerr << "Tool execution error: " << TEE.getMessage() << "\n"; + std::cerr << "Tool execution error: " << TEE.what() << "\n"; return 1; } catch (...) { std::cerr << "Whoops, an exception leaked out of bugpoint. " |