xref: /src/contrib/llvm-project/llvm/lib/TextAPI/TextAPIError.cpp (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1b1c73532SDimitry Andric //===- TextAPIError.cpp - Tapi Error ----------------------------*- C++ -*-===//
2b1c73532SDimitry Andric //
3b1c73532SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4b1c73532SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5b1c73532SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6b1c73532SDimitry Andric //
7b1c73532SDimitry Andric //===----------------------------------------------------------------------===//
8b1c73532SDimitry Andric ///
9b1c73532SDimitry Andric /// \file
10b1c73532SDimitry Andric /// \brief Implements TAPI Error.
11b1c73532SDimitry Andric ///
12b1c73532SDimitry Andric //===----------------------------------------------------------------------===//
13b1c73532SDimitry Andric 
14b1c73532SDimitry Andric #include "llvm/TextAPI/TextAPIError.h"
15b1c73532SDimitry Andric 
16b1c73532SDimitry Andric using namespace llvm;
17b1c73532SDimitry Andric using namespace llvm::MachO;
18b1c73532SDimitry Andric 
19b1c73532SDimitry Andric char TextAPIError::ID = 0;
20b1c73532SDimitry Andric 
log(raw_ostream & OS) const21b1c73532SDimitry Andric void TextAPIError::log(raw_ostream &OS) const {
22b1c73532SDimitry Andric   switch (EC) {
23b1c73532SDimitry Andric   case TextAPIErrorCode::NoSuchArchitecture:
24b1c73532SDimitry Andric     OS << "no such architecture";
25b1c73532SDimitry Andric     break;
26b1c73532SDimitry Andric   case TextAPIErrorCode::InvalidInputFormat:
27b1c73532SDimitry Andric     OS << "invalid input format";
28b1c73532SDimitry Andric     break;
29b1c73532SDimitry Andric   default:
30b1c73532SDimitry Andric     llvm_unreachable("unhandled TextAPIErrorCode");
31b1c73532SDimitry Andric   }
32b1c73532SDimitry Andric   if (!Msg.empty())
33b1c73532SDimitry Andric     OS << ": " << Msg;
34b1c73532SDimitry Andric   OS << "\n";
35b1c73532SDimitry Andric }
36b1c73532SDimitry Andric 
convertToErrorCode() const37b1c73532SDimitry Andric std::error_code TextAPIError::convertToErrorCode() const {
38b1c73532SDimitry Andric   llvm_unreachable("convertToErrorCode is not supported.");
39b1c73532SDimitry Andric }
40