#define TOOLRUNNER_H
#include "Support/SystemUtils.h"
+#include <exception>
#include <vector>
namespace llvm {
/// 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(); }
};
#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 ";
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"
return debugMiscompilation();
}
} catch (ToolExecutionError &TEE) {
- std::cerr << TEE.getMessage();
+ std::cerr << TEE.what();
return debugCodeGeneratorCrash();
}
#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 ";
#define TOOLRUNNER_H
#include "Support/SystemUtils.h"
+#include <exception>
#include <vector>
namespace llvm {
/// 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(); }
};
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. "