1 //===- Error.cxx - system_error extensions for llvm-cxxdump -----*- 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-cxxdump tool.
12 //===----------------------------------------------------------------------===//
15 #include "llvm/Support/ErrorHandling.h"
20 class cxxdump_error_category : public std::error_category {
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:
27 case cxxdump_error::file_not_found:
28 return "No such file.";
29 case cxxdump_error::unrecognized_file_format:
30 return "Unrecognized file type.";
33 "An enumerator of cxxdump_error does not have a message defined.");
39 const std::error_category &cxxdump_category() {
40 static cxxdump_error_category o;