TapiFile.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/ADT/iterator_range.h"
  21. #include "llvm/Object/SymbolicFile.h"
  22. #include "llvm/Support/Error.h"
  23. #include "llvm/Support/MemoryBuffer.h"
  24. #include "llvm/TextAPI/InterfaceFile.h"
  25. namespace llvm {
  26. namespace object {
  27. class TapiFile : public SymbolicFile {
  28. public:
  29. TapiFile(MemoryBufferRef Source, const MachO::InterfaceFile &interface,
  30. MachO::Architecture Arch);
  31. ~TapiFile() override;
  32. void moveSymbolNext(DataRefImpl &DRI) const override;
  33. Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override;
  34. Expected<uint32_t> getSymbolFlags(DataRefImpl DRI) const override;
  35. basic_symbol_iterator symbol_begin() const override;
  36. basic_symbol_iterator symbol_end() const override;
  37. static bool classof(const Binary *v) { return v->isTapiFile(); }
  38. bool is64Bit() { return MachO::is64Bit(Arch); }
  39. private:
  40. struct Symbol {
  41. StringRef Prefix;
  42. StringRef Name;
  43. uint32_t Flags;
  44. constexpr Symbol(StringRef Prefix, StringRef Name, uint32_t Flags)
  45. : Prefix(Prefix), Name(Name), Flags(Flags) {}
  46. };
  47. std::vector<Symbol> Symbols;
  48. MachO::Architecture Arch;
  49. };
  50. } // end namespace object.
  51. } // end namespace llvm.
  52. #endif // LLVM_OBJECT_TAPIFILE_H
  53. #ifdef __GNUC__
  54. #pragma GCC diagnostic pop
  55. #endif