116c1f436SCyndy Ishida //===- TextAPIError.cpp - 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 Implements TAPI Error. 1116c1f436SCyndy Ishida /// 1216c1f436SCyndy Ishida //===----------------------------------------------------------------------===// 1316c1f436SCyndy Ishida 1416c1f436SCyndy Ishida #include "llvm/TextAPI/TextAPIError.h" 1516c1f436SCyndy Ishida 1616c1f436SCyndy Ishida using namespace llvm; 1716c1f436SCyndy Ishida using namespace llvm::MachO; 1816c1f436SCyndy Ishida 1916c1f436SCyndy Ishida char TextAPIError::ID = 0; 2016c1f436SCyndy Ishida log(raw_ostream & OS) const2116c1f436SCyndy Ishidavoid TextAPIError::log(raw_ostream &OS) const { 2216c1f436SCyndy Ishida switch (EC) { 2316c1f436SCyndy Ishida case TextAPIErrorCode::NoSuchArchitecture: 24*ec64af59SCyndy Ishida OS << "no such architecture"; 25*ec64af59SCyndy Ishida break; 26d8a4011fSCyndy Ishida case TextAPIErrorCode::InvalidInputFormat: 27*ec64af59SCyndy Ishida OS << "invalid input format"; 28*ec64af59SCyndy Ishida break; 2916c1f436SCyndy Ishida default: 3016c1f436SCyndy Ishida llvm_unreachable("unhandled TextAPIErrorCode"); 3116c1f436SCyndy Ishida } 32*ec64af59SCyndy Ishida if (!Msg.empty()) 33*ec64af59SCyndy Ishida OS << ": " << Msg; 34*ec64af59SCyndy Ishida OS << "\n"; 3516c1f436SCyndy Ishida } 3616c1f436SCyndy Ishida convertToErrorCode() const3716c1f436SCyndy Ishidastd::error_code TextAPIError::convertToErrorCode() const { 3816c1f436SCyndy Ishida llvm_unreachable("convertToErrorCode is not supported."); 3916c1f436SCyndy Ishida } 40