1//===- llvm/TextAPI/TextAPIError.h - TAPI Error -----------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// \brief Define TAPI specific error codes.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TEXTAPI_TEXTAPIERROR_H
15#define LLVM_TEXTAPI_TEXTAPIERROR_H
16
17#include "llvm/Support/Error.h"
18
19namespace llvm::MachO {
20enum class TextAPIErrorCode {
21 NoSuchArchitecture,
22 EmptyResults,
23 GenericFrontendError,
24 InvalidInputFormat,
25 UnsupportedTarget
26};
27
28class TextAPIError : public llvm::ErrorInfo<TextAPIError> {
29public:
30 static char ID;
31 TextAPIErrorCode EC;
32 std::string Msg;
33
34 TextAPIError(TextAPIErrorCode EC) : EC(EC) {}
35 TextAPIError(TextAPIErrorCode EC, std::string Msg)
36 : EC(EC), Msg(std::move(Msg)) {}
37
38 void log(raw_ostream &OS) const override;
39 std::error_code convertToErrorCode() const override;
40};
41
42} // namespace llvm::MachO
43#endif // LLVM_TEXTAPI_TEXTAPIERROR_H
44

source code of llvm/include/llvm/TextAPI/TextAPIError.h