Fix some error messages; Make LLVMC pass through the exit code of a failed tool.
[oota-llvm.git] / tools / llvmc2 / 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_TOOLS_LLVMC2_ERROR_H
15 #define LLVM_TOOLS_LLVMC2_ERROR_H
16
17 #include <stdexcept>
18
19 namespace llvmc {
20
21   class error_code: public std::runtime_error {
22     int Code_;
23   public:
24     error_code (int c)
25       : std::runtime_error("Tool returned error code"), Code_(c)
26     {}
27
28     int code() const { return Code_; }
29   };
30
31 }
32
33 #endif //LLVM_TOOLS_LLVMC2_ERROR_H