TapiFile.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- TapiFile.h - Text-based Dynamic Library Stub -------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file declares the TapiFile interface.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_OBJECT_TAPIFILE_H
  18. #define LLVM_OBJECT_TAPIFILE_H
  19. #include "llvm/ADT/StringRef.h"
  20. #include "llvm/Object/Binary.h"
  21. #include "llvm/Object/SymbolicFile.h"
  22. #include "llvm/Support/Error.h"
  23. #include "llvm/Support/MemoryBufferRef.h"
  24. #include "llvm/TextAPI/Architecture.h"
  25. namespace llvm {
  26. class raw_ostream;
  27. namespace MachO {
  28. class InterfaceFile;
  29. }
  30. namespace object {
  31. class TapiFile : public SymbolicFile {
  32. public:
  33. TapiFile(MemoryBufferRef Source, const MachO::InterfaceFile &interface,
  34. MachO::Architecture Arch);
  35. ~TapiFile() override;
  36. void moveSymbolNext(DataRefImpl &DRI) const override;
  37. Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override;
  38. Expected<uint32_t> getSymbolFlags(DataRefImpl DRI) const override;
  39. basic_symbol_iterator symbol_begin() const override;
  40. basic_symbol_iterator symbol_end() const override;
  41. static bool classof(const Binary *v) { return v->isTapiFile(); }
  42. bool is64Bit() { return MachO::is64Bit(Arch); }
  43. private:
  44. struct Symbol {
  45. StringRef Prefix;
  46. StringRef Name;
  47. uint32_t Flags;
  48. constexpr Symbol(StringRef Prefix, StringRef Name, uint32_t Flags)
  49. : Prefix(Prefix), Name(Name), Flags(Flags) {}
  50. };
  51. std::vector<Symbol> Symbols;
  52. MachO::Architecture Arch;
  53. };
  54. } // end namespace object.
  55. } // end namespace llvm.
  56. #endif // LLVM_OBJECT_TAPIFILE_H
  57. #ifdef __GNUC__
  58. #pragma GCC diagnostic pop
  59. #endif