[ARM] Basic And/Or/Xor handling for MVE predicates
[llvm-complete.git] / tools / llvm-readobj / llvm-readobj.h
blob0e02da4cb847a62faea898dd6c731d5ec855795d
1 //===-- llvm-readobj.h ----------------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H
10 #define LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H
12 #include "llvm/Support/CommandLine.h"
13 #include "llvm/Support/Compiler.h"
14 #include "llvm/Support/ErrorOr.h"
15 #include "llvm/Support/Error.h"
16 #include <string>
18 namespace llvm {
19 namespace object {
20 class RelocationRef;
23 // Various helper functions.
24 LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
25 void reportError(StringRef Input, Error Err);
26 void reportWarning(Twine Msg);
27 void warn(llvm::Error Err);
28 void error(std::error_code EC);
29 void error(llvm::Error EC);
30 template <typename T> T error(llvm::Expected<T> &&E) {
31 error(E.takeError());
32 return std::move(*E);
35 template <class T> T unwrapOrError(ErrorOr<T> EO) {
36 if (EO)
37 return *EO;
38 reportError(EO.getError().message());
40 template <class T> T unwrapOrError(Expected<T> EO) {
41 if (EO)
42 return *EO;
43 std::string Buf;
44 raw_string_ostream OS(Buf);
45 logAllUnhandledErrors(EO.takeError(), OS);
46 OS.flush();
47 reportError(Buf);
49 } // namespace llvm
51 namespace opts {
52 extern llvm::cl::opt<bool> SectionRelocations;
53 extern llvm::cl::opt<bool> SectionSymbols;
54 extern llvm::cl::opt<bool> SectionData;
55 extern llvm::cl::opt<bool> ExpandRelocs;
56 extern llvm::cl::opt<bool> RawRelr;
57 extern llvm::cl::opt<bool> CodeViewSubsectionBytes;
58 extern llvm::cl::opt<bool> Demangle;
59 enum OutputStyleTy { LLVM, GNU };
60 extern llvm::cl::opt<OutputStyleTy> Output;
61 } // namespace opts
63 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
64 { #enum, ns::enum }
66 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
67 { #enum, std::underlying_type<enum_class>::type(enum_class::enum) }
69 #endif