Error.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //===- Error.h - system_error extensions for llvm-cxxdump -------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This declares a new error_category for the llvm-cxxdump tool.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
  13. #define LLVM_TOOLS_LLVM_CXXDUMP_ERROR_H
  14. #include <system_error>
  15. namespace llvm {
  16. const std::error_category &cxxdump_category();
  17. enum class cxxdump_error {
  18. success = 0,
  19. file_not_found,
  20. unrecognized_file_format,
  21. };
  22. inline std::error_code make_error_code(cxxdump_error e) {
  23. return std::error_code(static_cast<int>(e), cxxdump_category());
  24. }
  25. } // namespace llvm
  26. namespace std {
  27. template <>
  28. struct is_error_code_enum<llvm::cxxdump_error> : std::true_type {};
  29. }
  30. #endif