aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CompilerDriver/Error.h
diff options
context:
space:
mode:
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