116c1f436SCyndy Ishida //===- llvm/TextAPI/TextAPIError.h - TAPI Error -----------------*- C++ -*-===// 216c1f436SCyndy Ishida // 316c1f436SCyndy Ishida // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 416c1f436SCyndy Ishida // See https://llvm.org/LICENSE.txt for license information. 516c1f436SCyndy Ishida // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 616c1f436SCyndy Ishida // 716c1f436SCyndy Ishida //===----------------------------------------------------------------------===// 816c1f436SCyndy Ishida /// 916c1f436SCyndy Ishida /// \file 1016c1f436SCyndy Ishida /// \brief Define TAPI specific error codes. 1116c1f436SCyndy Ishida /// 1216c1f436SCyndy Ishida //===----------------------------------------------------------------------===// 1316c1f436SCyndy Ishida 1416c1f436SCyndy Ishida #ifndef LLVM_TEXTAPI_TEXTAPIERROR_H 1516c1f436SCyndy Ishida #define LLVM_TEXTAPI_TEXTAPIERROR_H 1616c1f436SCyndy Ishida 1716c1f436SCyndy Ishida #include "llvm/Support/Error.h" 1816c1f436SCyndy Ishida 1916c1f436SCyndy Ishida namespace llvm::MachO { 2016c1f436SCyndy Ishida enum class TextAPIErrorCode { 2116c1f436SCyndy Ishida NoSuchArchitecture, 2216c1f436SCyndy Ishida EmptyResults, 2316c1f436SCyndy Ishida GenericFrontendError, 24*e3627e26SCyndy Ishida InvalidInputFormat, 25*e3627e26SCyndy Ishida UnsupportedTarget 2616c1f436SCyndy Ishida }; 2716c1f436SCyndy Ishida 2816c1f436SCyndy Ishida class TextAPIError : public llvm::ErrorInfo<TextAPIError> { 2916c1f436SCyndy Ishida public: 3016c1f436SCyndy Ishida static char ID; 3116c1f436SCyndy Ishida TextAPIErrorCode EC; 32ec64af59SCyndy Ishida std::string Msg; 3316c1f436SCyndy Ishida TextAPIError(TextAPIErrorCode EC)3416c1f436SCyndy Ishida TextAPIError(TextAPIErrorCode EC) : EC(EC) {} TextAPIError(TextAPIErrorCode EC,std::string Msg)35ec64af59SCyndy Ishida TextAPIError(TextAPIErrorCode EC, std::string Msg) 36ec64af59SCyndy Ishida : EC(EC), Msg(std::move(Msg)) {} 3716c1f436SCyndy Ishida 3816c1f436SCyndy Ishida void log(raw_ostream &OS) const override; 3916c1f436SCyndy Ishida std::error_code convertToErrorCode() const override; 4016c1f436SCyndy Ishida }; 4116c1f436SCyndy Ishida 4216c1f436SCyndy Ishida } // namespace llvm::MachO 4316c1f436SCyndy Ishida #endif // LLVM_TEXTAPI_TEXTAPIERROR_H 44