1 //===- Error.cpp - system_error extensions for obj2yaml ---------*- 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 //===----------------------------------------------------------------------===//
11 #include "llvm/Support/ErrorHandling.h"
16 class _obj2yaml_error_category : public std::error_category {
18 const char *name() const LLVM_NOEXCEPT override;
19 std::string message(int ev) const override;
23 const char *_obj2yaml_error_category::name() const { return "obj2yaml"; }
25 std::string _obj2yaml_error_category::message(int ev) const {
26 switch (static_cast<obj2yaml_error>(ev)) {
27 case obj2yaml_error::success:
29 case obj2yaml_error::file_not_found:
30 return "No such file.";
31 case obj2yaml_error::unrecognized_file_format:
32 return "Unrecognized file type.";
33 case obj2yaml_error::unsupported_obj_file_format:
34 return "Unsupported object file format.";
36 llvm_unreachable("An enumerator of obj2yaml_error does not have a message "
41 const std::error_category &obj2yaml_category() {
42 static _obj2yaml_error_category o;