Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / tools / llvm-readobj / llvm-readobj.h
blob5a9fe28d883e57aec64c9f37f21e3ba9e58c0b82
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"
19 #include <string>
21 namespace llvm {
22 namespace object {
23 class RelocationRef;
26 // Various helper functions.
27 [[noreturn]] void reportError(Error Err, StringRef Input);
28 void reportWarning(Error Err, StringRef Input);
30 template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
31 if (EO)
32 return *EO;
33 reportError(EO.takeError(), Input);
35 } // namespace llvm
37 namespace opts {
38 extern bool SectionRelocations;
39 extern bool SectionSymbols;
40 extern bool SectionData;
41 extern bool ExpandRelocs;
42 extern bool RawRelr;
43 extern bool CodeViewSubsectionBytes;
44 extern bool Demangle;
45 enum OutputStyleTy { LLVM, GNU, JSON, UNKNOWN };
46 extern OutputStyleTy Output;
47 } // namespace opts
49 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
50 { #enum, ns::enum }
52 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
53 { #enum, std::underlying_type_t<enum_class>(enum_class::enum) }
55 #endif