[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / llvm / tools / llvm-readobj / llvm-readobj.h
blob532e43d4e16b0d8657a9ab3e93457887e7c099c2
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 "ObjDumper.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/Support/CommandLine.h"
16 #include "llvm/Support/Compiler.h"
17 #include "llvm/Support/Error.h"
18 #include "llvm/Support/ErrorOr.h"
20 namespace llvm {
21 namespace object {
22 class RelocationRef;
25 // Various helper functions.
26 [[noreturn]] void reportError(Error Err, StringRef Input);
27 void reportWarning(Error Err, StringRef Input);
29 template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
30 if (EO)
31 return *EO;
32 reportError(EO.takeError(), Input);
34 } // namespace llvm
36 namespace opts {
37 extern bool SectionRelocations;
38 extern bool SectionSymbols;
39 extern bool SectionData;
40 extern bool ExpandRelocs;
41 extern bool RawRelr;
42 extern bool CodeViewSubsectionBytes;
43 extern bool Demangle;
44 enum OutputStyleTy { LLVM, GNU, JSON, UNKNOWN };
45 extern OutputStyleTy Output;
46 } // namespace opts
48 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
49 { #enum, ns::enum }
51 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
52 { #enum, std::underlying_type_t<enum_class>(enum_class::enum) }
54 #endif