comparison include/llvm/DebugInfo/CodeView/CodeViewError.h @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
146:3fc4d5c3e21e 148:63bd29f05246
1 //===- CodeViewError.h - Error extensions for CodeView ----------*- C++ -*-===// 1 //===- CodeViewError.h - Error extensions for CodeView ----------*- C++ -*-===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // 4 // See https://llvm.org/LICENSE.txt for license information.
5 // This file is distributed under the University of Illinois Open Source 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 // License. See LICENSE.TXT for details.
7 // 6 //
8 //===----------------------------------------------------------------------===// 7 //===----------------------------------------------------------------------===//
9 8
10 #ifndef LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H 9 #ifndef LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
11 #define LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H 10 #define LLVM_DEBUGINFO_PDB_CODEVIEW_CODEVIEWERROR_H
22 operation_unsupported, 21 operation_unsupported,
23 corrupt_record, 22 corrupt_record,
24 no_records, 23 no_records,
25 unknown_member_record, 24 unknown_member_record,
26 }; 25 };
26 } // namespace codeview
27 } // namespace llvm
28
29 namespace std {
30 template <>
31 struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
32 } // namespace std
33
34 namespace llvm {
35 namespace codeview {
36 const std::error_category &CVErrorCategory();
37
38 inline std::error_code make_error_code(cv_error_code E) {
39 return std::error_code(static_cast<int>(E), CVErrorCategory());
40 }
27 41
28 /// Base class for errors originating when parsing raw PDB files 42 /// Base class for errors originating when parsing raw PDB files
29 class CodeViewError : public ErrorInfo<CodeViewError> { 43 class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
30 public: 44 public:
45 using ErrorInfo<CodeViewError,
46 StringError>::ErrorInfo; // inherit constructors
47 CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
31 static char ID; 48 static char ID;
32 CodeViewError(cv_error_code C); 49 };
33 CodeViewError(const std::string &Context);
34 CodeViewError(cv_error_code C, const std::string &Context);
35 50
36 void log(raw_ostream &OS) const override; 51 } // namespace codeview
37 const std::string &getErrorMessage() const; 52 } // namespace llvm
38 std::error_code convertToErrorCode() const override;
39 53
40 private:
41 std::string ErrMsg;
42 cv_error_code Code;
43 };
44 }
45 }
46 #endif 54 #endif