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