diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-18 20:21:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-18 20:21:57 +0000 |
commit | 8c56be5e2b860ce5f22ed157c1b02409c353749c (patch) | |
tree | 148acae9b800048cb98bb5aa9b39469d0540f3ac /include/llvm | |
parent | f5c8146a7cf899a678dc3979df6a3c99d7f19fc3 (diff) | |
download | external_llvm-8c56be5e2b860ce5f22ed157c1b02409c353749c.zip external_llvm-8c56be5e2b860ce5f22ed157c1b02409c353749c.tar.gz external_llvm-8c56be5e2b860ce5f22ed157c1b02409c353749c.tar.bz2 |
When an error occurs executing a tool, we now throw an exception instead
of calling exit(1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Support/ToolRunner.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/include/llvm/Support/ToolRunner.h b/include/llvm/Support/ToolRunner.h index d5c82f4..097fc6a 100644 --- a/include/llvm/Support/ToolRunner.h +++ b/include/llvm/Support/ToolRunner.h @@ -25,6 +25,19 @@ namespace llvm { class CBE; class LLC; + +/// ToolExecutionError - An instance of this class is thrown by the +/// AbstractInterpreter instances if there is an error running a tool (e.g., LLC +/// crashes) which prevents execution of the program. +/// +class ToolExecutionError { + std::string Message; +public: + ToolExecutionError(const std::string &M) : Message(M) {} + const std::string getMessage() const { return Message; } +}; + + //===---------------------------------------------------------------------===// // GCC abstraction // @@ -108,10 +121,11 @@ public: const std::vector<std::string> &SharedLibs = std::vector<std::string>()); - // Sometimes we just want to go half-way and only generate the .c file, - // not necessarily compile it with GCC and run the program. + // Sometimes we just want to go half-way and only generate the .c file, not + // necessarily compile it with GCC and run the program. This throws an + // exception if LLC crashes. // - virtual int OutputC(const std::string &Bytecode, std::string &OutputCFile); + virtual void OutputC(const std::string &Bytecode, std::string &OutputCFile); }; @@ -134,9 +148,10 @@ public: std::vector<std::string>()); // Sometimes we just want to go half-way and only generate the .s file, - // not necessarily compile it all the way and run the program. + // not necessarily compile it all the way and run the program. This throws + // an exception if execution of LLC fails. // - int OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile); + void OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile); }; } // End llvm namespace |