[Alignment][NFC] Value::getPointerAlignment returns MaybeAlign
[llvm-core.git] / tools / llvm-readobj / llvm-readobj.h
blobd9813f5dea622225a121703319a24b72cb9c0947
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(Error Err, StringRef Input);
25 void reportWarning(Error Err, StringRef Input);
27 template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
28 if (EO)
29 return *EO;
30 reportError(EO.takeError(), Input);
32 } // namespace llvm
34 namespace opts {
35 extern llvm::cl::opt<bool> SectionRelocations;
36 extern llvm::cl::opt<bool> SectionSymbols;
37 extern llvm::cl::opt<bool> SectionData;
38 extern llvm::cl::opt<bool> ExpandRelocs;
39 extern llvm::cl::opt<bool> RawRelr;
40 extern llvm::cl::opt<bool> CodeViewSubsectionBytes;
41 extern llvm::cl::opt<bool> Demangle;
42 enum OutputStyleTy { LLVM, GNU };
43 extern llvm::cl::opt<OutputStyleTy> Output;
44 } // namespace opts
46 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
47 { #enum, ns::enum }
49 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
50 { #enum, std::underlying_type<enum_class>::type(enum_class::enum) }
52 #endif