]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-readobj/llvm-readobj.h
MFV r319744,r319745: 8269 dtrace stddev aggregation is normalized incorrectly
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-readobj / llvm-readobj.h
1 //===-- llvm-readobj.h ----------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H
11 #define LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H
12
13 #include "llvm/Support/CommandLine.h"
14 #include "llvm/Support/Compiler.h"
15 #include "llvm/Support/ErrorOr.h"
16 #include "llvm/Support/Error.h"
17 #include <string>
18
19 namespace llvm {
20   namespace object {
21     class RelocationRef;
22   }
23
24   // Various helper functions.
25   LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
26   void error(std::error_code EC);
27   void error(llvm::Error EC);
28   template <class T> T unwrapOrError(ErrorOr<T> EO) {
29     if (EO)
30       return *EO;
31     reportError(EO.getError().message());
32   }
33   template <class T> T unwrapOrError(Expected<T> EO) {
34     if (EO)
35       return *EO;
36     std::string Buf;
37     raw_string_ostream OS(Buf);
38     logAllUnhandledErrors(EO.takeError(), OS, "");
39     OS.flush();
40     reportError(Buf);
41   }
42   bool relocAddressLess(object::RelocationRef A,
43                         object::RelocationRef B);
44 } // namespace llvm
45
46 namespace opts {
47   extern llvm::cl::list<std::string> InputFilenames;
48   extern llvm::cl::opt<bool> FileHeaders;
49   extern llvm::cl::opt<bool> Sections;
50   extern llvm::cl::opt<bool> SectionRelocations;
51   extern llvm::cl::opt<bool> SectionSymbols;
52   extern llvm::cl::opt<bool> SectionData;
53   extern llvm::cl::opt<bool> Relocations;
54   extern llvm::cl::opt<bool> Symbols;
55   extern llvm::cl::opt<bool> DynamicSymbols;
56   extern llvm::cl::opt<bool> UnwindInfo;
57   extern llvm::cl::opt<bool> ExpandRelocs;
58   extern llvm::cl::opt<bool> CodeView;
59   extern llvm::cl::opt<bool> CodeViewSubsectionBytes;
60   extern llvm::cl::opt<bool> ARMAttributes;
61   extern llvm::cl::opt<bool> MipsPLTGOT;
62   enum OutputStyleTy { LLVM, GNU };
63   extern llvm::cl::opt<OutputStyleTy> Output;
64 } // namespace opts
65
66 #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
67   { #enum, ns::enum }
68
69 #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
70   { #enum, std::underlying_type<enum_class>::type(enum_class::enum) }
71
72 #endif