1 //===-- MachOUtils.h - Mach-o specific helpers for dsymutil --------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 #ifndef LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H 10 #define LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H 11 12 #include "llvm/ADT/StringRef.h" 13 #include "llvm/Support/FileSystem.h" 14 #include <string> 15 16 namespace llvm { 17 class MCStreamer; 18 class raw_fd_ostream; 19 namespace dsymutil { 20 class DebugMap; 21 struct LinkOptions; 22 namespace MachOUtils { 23 24 struct ArchAndFile { 25 std::string Arch; 26 // Optional because TempFile has no default constructor. 27 Optional<llvm::sys::fs::TempFile> File; 28 29 llvm::Error createTempFile(); 30 llvm::StringRef path() const; 31 ArchAndFileArchAndFile32 ArchAndFile(StringRef Arch) : Arch(Arch) {} 33 ArchAndFile(ArchAndFile &&A) = default; 34 ~ArchAndFile(); 35 }; 36 37 bool generateUniversalBinary(SmallVectorImpl<ArchAndFile> &ArchFiles, 38 StringRef OutputFileName, const LinkOptions &, 39 StringRef SDKPath); 40 41 bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS, 42 raw_fd_ostream &OutFile); 43 44 std::string getArchName(StringRef Arch); 45 } // namespace MachOUtils 46 } // namespace dsymutil 47 } // namespace llvm 48 #endif // LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H 49