[llvm-commits] CVS: llvm/include/llvm/Support/ToolRunner.h

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 18 14:51:57 PST 2004


Changes in directory llvm/include/llvm/Support:

ToolRunner.h updated: 1.7 -> 1.8

---
Log message:

When an error occurs executing a tool, we now throw an exception instead 
of calling exit(1).


---
Diffs of the changes:  (+20 -5)

Index: llvm/include/llvm/Support/ToolRunner.h
diff -u llvm/include/llvm/Support/ToolRunner.h:1.7 llvm/include/llvm/Support/ToolRunner.h:1.8
--- llvm/include/llvm/Support/ToolRunner.h:1.7	Tue Feb 17 00:39:48 2004
+++ llvm/include/llvm/Support/ToolRunner.h	Wed Feb 18 14:21:43 2004
@@ -25,6 +25,19 @@
 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 @@
                              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 @@
                                 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





More information about the llvm-commits mailing list