fa678cfbfb92927050cf8ae2dafdfd508dd7764e
[oota-llvm.git] / include / llvm / CompilerDriver / Error.h
1 //===--- Error.h - The LLVM Compiler Driver ---------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  Exception classes for llvmc.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H
15 #define LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H
16
17 #include <stdexcept>
18
19 namespace llvmc {
20
21   /// error_code - This gets thrown during the compilation process if a tool
22   /// invocation returns a non-zero exit code.
23   class error_code: public std::runtime_error {
24     int Code_;
25   public:
26     error_code (int c)
27       : std::runtime_error("Tool returned error code"), Code_(c)
28     {}
29
30     int code() const { return Code_; }
31   };
32
33 }
34
35 #endif // LLVM_INCLUDE_COMPILER_DRIVER_ERROR_H