mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Make ToolExecutionError inherit std::exception and implement its
interface: getMessage() is gone, use what() instead. llvm-svn: 11621
This commit is contained in:
parent
fbaf7b3944
commit
59c646da40
@ -18,6 +18,7 @@
|
|||||||
#define TOOLRUNNER_H
|
#define TOOLRUNNER_H
|
||||||
|
|
||||||
#include "Support/SystemUtils.h"
|
#include "Support/SystemUtils.h"
|
||||||
|
#include <exception>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -30,11 +31,12 @@ class LLC;
|
|||||||
/// AbstractInterpreter instances if there is an error running a tool (e.g., LLC
|
/// AbstractInterpreter instances if there is an error running a tool (e.g., LLC
|
||||||
/// crashes) which prevents execution of the program.
|
/// crashes) which prevents execution of the program.
|
||||||
///
|
///
|
||||||
class ToolExecutionError {
|
class ToolExecutionError : std::exception {
|
||||||
std::string Message;
|
std::string Message;
|
||||||
public:
|
public:
|
||||||
ToolExecutionError(const std::string &M) : Message(M) {}
|
explicit ToolExecutionError(const std::string &M) : Message(M) {}
|
||||||
const std::string getMessage() const { return Message; }
|
virtual ~ToolExecutionError() throw();
|
||||||
|
virtual const char* what() const throw() { return Message.c_str(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
ToolExecutionError::~ToolExecutionError() throw() { }
|
||||||
|
|
||||||
static void ProcessFailure(std::string ProgPath, const char** Args) {
|
static void ProcessFailure(std::string ProgPath, const char** Args) {
|
||||||
std::ostringstream OS;
|
std::ostringstream OS;
|
||||||
OS << "\nError running tool:\n ";
|
OS << "\nError running tool:\n ";
|
||||||
|
@ -159,7 +159,7 @@ bool BugDriver::run() {
|
|||||||
CreatedOutput = true;
|
CreatedOutput = true;
|
||||||
std::cout << "Reference output is: " << ReferenceOutputFile << "\n";
|
std::cout << "Reference output is: " << ReferenceOutputFile << "\n";
|
||||||
} catch (ToolExecutionError &TEE) {
|
} catch (ToolExecutionError &TEE) {
|
||||||
std::cerr << TEE.getMessage();
|
std::cerr << TEE.what();
|
||||||
if (Interpreter != cbe) {
|
if (Interpreter != cbe) {
|
||||||
std::cerr << "*** There is a bug running the C backend. Either debug"
|
std::cerr << "*** There is a bug running the C backend. Either debug"
|
||||||
<< " it (use the -run-cbe bugpoint option), or fix the error"
|
<< " it (use the -run-cbe bugpoint option), or fix the error"
|
||||||
@ -183,7 +183,7 @@ bool BugDriver::run() {
|
|||||||
return debugMiscompilation();
|
return debugMiscompilation();
|
||||||
}
|
}
|
||||||
} catch (ToolExecutionError &TEE) {
|
} catch (ToolExecutionError &TEE) {
|
||||||
std::cerr << TEE.getMessage();
|
std::cerr << TEE.what();
|
||||||
return debugCodeGeneratorCrash();
|
return debugCodeGeneratorCrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ int main(int argc, char **argv) {
|
|||||||
try {
|
try {
|
||||||
return D.run();
|
return D.run();
|
||||||
} catch (ToolExecutionError &TEE) {
|
} catch (ToolExecutionError &TEE) {
|
||||||
std::cerr << "Tool execution error: " << TEE.getMessage() << "\n";
|
std::cerr << "Tool execution error: " << TEE.what() << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cerr << "Whoops, an exception leaked out of bugpoint. "
|
std::cerr << "Whoops, an exception leaked out of bugpoint. "
|
||||||
|
Loading…
Reference in New Issue
Block a user