llvm-readobj.h 1.5 KB

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