]> git.proxmox.com Git - rustc.git/blame - src/llvm/tools/llvm-vtabledump/Error.cpp
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / tools / llvm-vtabledump / Error.cpp
CommitLineData
1a4d82fc
JJ
1//===- Error.cpp - system_error extensions for llvm-vtabledump --*- 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-vtabledump tool.
11//
12//===----------------------------------------------------------------------===//
13
14#include "Error.h"
15#include "llvm/Support/ErrorHandling.h"
16
17using namespace llvm;
18
19namespace {
20class vtabledump_error_category : public std::error_category {
21public:
22 const char *name() const LLVM_NOEXCEPT override { return "llvm.vtabledump"; }
23 std::string message(int ev) const override {
24 switch (static_cast<vtabledump_error>(ev)) {
25 case vtabledump_error::success:
26 return "Success";
27 case vtabledump_error::file_not_found:
28 return "No such file.";
29 case vtabledump_error::unrecognized_file_format:
30 return "Unrecognized file type.";
31 }
32 llvm_unreachable(
33 "An enumerator of vtabledump_error does not have a message defined.");
34 }
35};
36} // namespace
37
38namespace llvm {
39const std::error_category &vtabledump_category() {
40 static vtabledump_error_category o;
41 return o;
42}
43} // namespace llvm