2
0

Error.h 1012 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. //===- Error.h - 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 declares a new error_category for the llvm-cxxdump tool.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
  14. #define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
  15. #include <system_error>
  16. namespace llvm {
  17. const std::error_category &cxxdump_category();
  18. enum class cxxdump_error {
  19. success = 0,
  20. file_not_found,
  21. unrecognized_file_format,
  22. };
  23. inline std::error_code make_error_code(cxxdump_error e) {
  24. return std::error_code(static_cast<int>(e), cxxdump_category());
  25. }
  26. } // namespace llvm
  27. namespace std {
  28. template <>
  29. struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
  30. }
  31. #endif