diff 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
line wrap: on
line diff
--- a/include/llvm/DebugInfo/CodeView/CodeViewError.h	Sun Dec 23 19:23:36 2018 +0900
+++ b/include/llvm/DebugInfo/CodeView/CodeViewError.h	Wed Aug 14 19:46:37 2019 +0900
@@ -1,9 +1,8 @@
 //===- CodeViewError.h - Error extensions for CodeView ----------*- C++ -*-===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 
@@ -24,23 +23,32 @@
   no_records,
   unknown_member_record,
 };
+} // namespace codeview
+} // namespace llvm
+
+namespace std {
+template <>
+struct is_error_code_enum<llvm::codeview::cv_error_code> : std::true_type {};
+} // namespace std
+
+namespace llvm {
+namespace codeview {
+const std::error_category &CVErrorCategory();
+
+inline std::error_code make_error_code(cv_error_code E) {
+  return std::error_code(static_cast<int>(E), CVErrorCategory());
+}
 
 /// Base class for errors originating when parsing raw PDB files
-class CodeViewError : public ErrorInfo<CodeViewError> {
+class CodeViewError : public ErrorInfo<CodeViewError, StringError> {
 public:
+  using ErrorInfo<CodeViewError,
+                  StringError>::ErrorInfo; // inherit constructors
+  CodeViewError(const Twine &S) : ErrorInfo(S, cv_error_code::unspecified) {}
   static char ID;
-  CodeViewError(cv_error_code C);
-  CodeViewError(const std::string &Context);
-  CodeViewError(cv_error_code C, const std::string &Context);
+};
 
-  void log(raw_ostream &OS) const override;
-  const std::string &getErrorMessage() const;
-  std::error_code convertToErrorCode() const override;
+} // namespace codeview
+} // namespace llvm
 
-private:
-  std::string ErrMsg;
-  cv_error_code Code;
-};
-}
-}
 #endif