diff options
Diffstat (limited to 'include/llvm/CompilerDriver/Error.h')
-rw-r--r-- | include/llvm/CompilerDriver/Error.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/llvm/CompilerDriver/Error.h b/include/llvm/CompilerDriver/Error.h new file mode 100644 index 0000000..fa678cf --- /dev/null +++ b/include/llvm/CompilerDriver/Error.h @@ -0,0 +1,35 @@ +//===--- Error.h - The LLVM Compiler Driver ---------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open +// Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Exception classes for llvmc. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H +#define LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H + +#include <stdexcept> + +namespace llvmc { + + /// 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) + {} + + int code() const { return Code_; } + }; + +} + +#endif // LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H |