Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

  1. //===- Error.h - system_error extensions for Object -------------*- 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 Object library.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_OBJECT_ERROR_H
  14. #define LLVM_OBJECT_ERROR_H
  15. #include "llvm/Support/system_error.h"
  16. namespace llvm {
  17. namespace object {
  18. const error_category &object_category();
  19. struct object_error {
  20. enum _ {
  21. success = 0,
  22. invalid_file_type,
  23. parse_failed,
  24. unexpected_eof
  25. };
  26. _ v_;
  27. object_error(_ v) : v_(v) {}
  28. explicit object_error(int v) : v_(_(v)) {}
  29. operator int() const {return v_;}
  30. };
  31. inline error_code make_error_code(object_error e) {
  32. return error_code(static_cast<int>(e), object_category());
  33. }
  34. } // end namespace object.
  35. template <> struct is_error_code_enum<object::object_error> : true_type { };
  36. template <> struct is_error_code_enum<object::object_error::_> : true_type { };
  37. } // end namespace llvm.
  38. #endif