llvm-readobj.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H
  9. #define LLVM_TOOLS_LLVM_READOBJ_LLVM_READOBJ_H
  10. #include "llvm/Support/CommandLine.h"
  11. #include "llvm/Support/Compiler.h"
  12. #include "llvm/Support/ErrorOr.h"
  13. #include "llvm/Support/Error.h"
  14. #include <string>
  15. namespace llvm {
  16. namespace object {
  17. class RelocationRef;
  18. }
  19. // Various helper functions.
  20. LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input);
  21. void reportWarning(Error Err, StringRef Input);
  22. template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
  23. if (EO)
  24. return *EO;
  25. reportError(EO.takeError(), Input);
  26. }
  27. } // namespace llvm
  28. namespace opts {
  29. extern llvm::cl::opt<bool> SectionRelocations;
  30. extern llvm::cl::opt<bool> SectionSymbols;
  31. extern llvm::cl::opt<bool> SectionData;
  32. extern llvm::cl::opt<bool> ExpandRelocs;
  33. extern llvm::cl::opt<bool> RawRelr;
  34. extern llvm::cl::opt<bool> CodeViewSubsectionBytes;
  35. extern llvm::cl::opt<bool> Demangle;
  36. enum OutputStyleTy { LLVM, GNU };
  37. extern llvm::cl::opt<OutputStyleTy> Output;
  38. } // namespace opts
  39. #define LLVM_READOBJ_ENUM_ENT(ns, enum) \
  40. { #enum, ns::enum }
  41. #define LLVM_READOBJ_ENUM_CLASS_ENT(enum_class, enum) \
  42. { #enum, std::underlying_type<enum_class>::type(enum_class::enum) }
  43. #endif