aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CompilerDriver/Error.h
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-07-23 03:42:55 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-07-23 03:42:55 +0000
commitb374d4fd82ec01f8549a69a25f4938584c136111 (patch)
treece0ecf3b2a6b2b169c9fd2b43f9af97838e99bbc /include/llvm/CompilerDriver/Error.h
parenta23650bc0161716aadba97e2e5f92eac7c11d80b (diff)
Get rid of exceptions in llvmc.
llvmc can be now compiled with llvm-gcc on Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CompilerDriver/Error.h')
-rw-r--r--include/llvm/CompilerDriver/Error.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/include/llvm/CompilerDriver/Error.h b/include/llvm/CompilerDriver/Error.h
index fa678cfbfb..0233929616 100644
--- a/include/llvm/CompilerDriver/Error.h
+++ b/include/llvm/CompilerDriver/Error.h
@@ -7,29 +7,27 @@
//
//===----------------------------------------------------------------------===//
//
-// Exception classes for llvmc.
+// Error handling.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H
#define LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H
-#include <stdexcept>
+#include "llvm/Support/raw_ostream.h"
-namespace llvmc {
+#include <string>
- /// error_code - This gets thrown during the compilation process if a tool
- /// invocation returns a non-zero exit code.
- class error_code: public std::runtime_error {
- int Code_;
- public:
- error_code (int c)
- : std::runtime_error("Tool returned error code"), Code_(c)
- {}
+namespace llvmc {
- int code() const { return Code_; }
- };
+ inline void PrintError(const char* Err) {
+ extern const char* ProgramName;
+ llvm::errs() << ProgramName << ": " << Err << '\n';
+ }
+ inline void PrintError(const std::string& Err) {
+ PrintError(Err.c_str());
+ }
}
#endif // LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H