Mercurial > hg > CbC > CbC_llvm
comparison tools/llvm-cxxdump/Error.cpp @ 95:afa8332a0e37 LLVM3.8
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
1 //===- Error.cxx - system_error extensions for llvm-cxxdump -----*- C++ -*-===// | |
2 // | |
3 // The LLVM Compiler Infrastructure | |
4 // | |
5 // This file is distributed under the University of Illinois Open Source | |
6 // License. See LICENSE.TXT for details. | |
7 // | |
8 //===----------------------------------------------------------------------===// | |
9 // | |
10 // This defines a new error_category for the llvm-cxxdump tool. | |
11 // | |
12 //===----------------------------------------------------------------------===// | |
13 | |
14 #include "Error.h" | |
15 #include "llvm/Support/ErrorHandling.h" | |
16 | |
17 using namespace llvm; | |
18 | |
19 namespace { | |
20 class cxxdump_error_category : public std::error_category { | |
21 public: | |
22 const char *name() const LLVM_NOEXCEPT override { return "llvm.cxxdump"; } | |
23 std::string message(int ev) const override { | |
24 switch (static_cast<cxxdump_error>(ev)) { | |
25 case cxxdump_error::success: | |
26 return "Success"; | |
27 case cxxdump_error::file_not_found: | |
28 return "No such file."; | |
29 case cxxdump_error::unrecognized_file_format: | |
30 return "Unrecognized file type."; | |
31 } | |
32 llvm_unreachable( | |
33 "An enumerator of cxxdump_error does not have a message defined."); | |
34 } | |
35 }; | |
36 } // namespace | |
37 | |
38 namespace llvm { | |
39 const std::error_category &cxxdump_category() { | |
40 static cxxdump_error_category o; | |
41 return o; | |
42 } | |
43 } // namespace llvm |