CodeViewError.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- CodeViewError.h - Error extensions for CodeView ----------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEWERROR_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWERROR_H
  15. #include "llvm/Support/Error.h"
  16. namespace llvm {
  17. namespace codeview {
  18. enum class cv_error_code {
  19. unspecified = 1,
  20. insufficient_buffer,
  21. operation_unsupported,
  22. corrupt_record,
  23. no_records,
  24. unknown_member_record,
  25. };
  26. } // namespace codeview
  27. } // namespace llvm
  28. namespace std {
  29. template <>
  30. struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
  31. } // namespace std
  32. namespace llvm {
  33. namespace codeview {
  34. const std::error_category &CVErrorCategory();
  35. inline std::error_code make_error_code(cv_error_code E) {
  36. return std::error_code(static_cast<int>(E), CVErrorCategory());
  37. }
  38. /// Base class for errors originating when parsing raw PDB files
  39. class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
  40. public:
  41. using ErrorInfo<CodeViewError,
  42. StringError>::ErrorInfo; // inherit constructors
  43. CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
  44. static char ID;
  45. };
  46. } // namespace codeview
  47. } // namespace llvm
  48. #endif
  49. #ifdef __GNUC__
  50. #pragma GCC diagnostic pop
  51. #endif