1 //===- Error.cpp - system_error extensions for llvm-vtabledump --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This defines a new error_category for the llvm-vtabledump tool.
12 //===----------------------------------------------------------------------===//
15 #include "llvm/Support/ErrorHandling.h"
20 class vtabledump_error_category : public std::error_category {
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:
27 case vtabledump_error::file_not_found:
28 return "No such file.";
29 case vtabledump_error::unrecognized_file_format:
30 return "Unrecognized file type.";
33 "An enumerator of vtabledump_error does not have a message defined.");
39 const std::error_category &vtabledump_category() {
40 static vtabledump_error_category o;