[ARM] sext of a load is free
[llvm-core.git] / tools / llvm-readobj / llvm-readobj.h
blobd7fbb0e4d2585ff7385d7d8b7e532be000053cc3
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 reportWarning(StringRef Input, Error Err);
28 void warn(llvm::Error Err);
29 void error(std::error_code EC);
30 void error(llvm::Error EC);
32 template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
33 if (EO)
34 return *EO;
35 reportError(Input, EO.takeError());
36 llvm_unreachable("reportError shouldn't return in this case");
38 } // namespace llvm
40 namespace opts {
41 extern llvm::cl::opt<bool> SectionRelocations;
42 extern llvm::cl::opt<bool> SectionSymbols;
43 extern llvm::cl::opt<bool> SectionData;
44 extern llvm::cl::opt<bool> ExpandRelocs;
45 extern llvm::cl::opt<bool> RawRelr;
46 extern llvm::cl::opt<bool> CodeViewSubsectionBytes;
47 extern llvm::cl::opt<bool> Demangle;
48 enum OutputStyleTy { LLVM, GNU };
49 extern llvm::cl::opt<OutputStyleTy> Output;
50 } // namespace opts
52 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
53 { #enum, ns::enum }
55 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
56 { #enum, std::underlying_type<enum_class>::type(enum_class::enum) }
58 #endif