MachOUtils.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //===-- MachOUtils.h - Mach-o specific helpers for dsymutil --------------===//
  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_DSYMUTIL_MACHOUTILS_H
  9. #define LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H
  10. #include "SymbolMap.h"
  11. #include "llvm/ADT/StringRef.h"
  12. #include "llvm/Support/FileSystem.h"
  13. #include "llvm/Support/VirtualFileSystem.h"
  14. #include <string>
  15. namespace llvm {
  16. class MCStreamer;
  17. class raw_fd_ostream;
  18. namespace dsymutil {
  19. class DebugMap;
  20. struct LinkOptions;
  21. namespace MachOUtils {
  22. struct ArchAndFile {
  23. std::string Arch;
  24. std::unique_ptr<llvm::sys::fs::TempFile> File;
  25. llvm::Error createTempFile();
  26. llvm::StringRef path() const;
  27. ArchAndFile(StringRef Arch) : Arch(std::string(Arch)) {}
  28. ArchAndFile(ArchAndFile &&A) = default;
  29. ArchAndFile &operator=(ArchAndFile &&A) = default;
  30. ~ArchAndFile();
  31. };
  32. bool generateUniversalBinary(SmallVectorImpl<ArchAndFile> &ArchFiles,
  33. StringRef OutputFileName, const LinkOptions &,
  34. StringRef SDKPath);
  35. bool generateDsymCompanion(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
  36. const DebugMap &DM, SymbolMapTranslator &Translator,
  37. MCStreamer &MS, raw_fd_ostream &OutFile);
  38. std::string getArchName(StringRef Arch);
  39. } // namespace MachOUtils
  40. } // namespace dsymutil
  41. } // namespace llvm
  42. #endif // LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H