blob: c24f963e1d9857c7fc7892289c122fa94085e90c [file] [log] [blame]
Frederic Riss7a425782015-08-05 18:27:44 +00001//===-- 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
Jonas Devlieghere20767d12019-01-07 23:27:25 +000012#include "SymbolMap.h"
13
Frederic Riss7a425782015-08-05 18:27:44 +000014#include "llvm/ADT/StringRef.h"
Jonas Devlieghere58d4a392018-07-29 14:56:15 +000015#include "llvm/Support/FileSystem.h"
Jonas Devlieghere20767d12019-01-07 23:27:25 +000016
Jonas Devlieghere3ad0c5a2018-02-22 11:32:51 +000017#include <string>
Frederic Riss7a425782015-08-05 18:27:44 +000018
19namespace llvm {
Frederic Rissef8ad012015-09-02 16:49:13 +000020class MCStreamer;
21class raw_fd_ostream;
Frederic Riss7a425782015-08-05 18:27:44 +000022namespace dsymutil {
Frederic Rissef8ad012015-09-02 16:49:13 +000023class DebugMap;
Frederic Riss7a425782015-08-05 18:27:44 +000024struct LinkOptions;
25namespace MachOUtils {
26
Jonas Devlieghere58d4a392018-07-29 14:56:15 +000027struct ArchAndFile {
28 std::string Arch;
29 // Optional because TempFile has no default constructor.
30 Optional<llvm::sys::fs::TempFile> File;
31
32 llvm::Error createTempFile();
33 llvm::StringRef path() const;
34
35 ArchAndFile(StringRef Arch) : Arch(Arch) {}
36 ArchAndFile(ArchAndFile &&A) = default;
37 ~ArchAndFile();
Frederic Riss7a425782015-08-05 18:27:44 +000038};
39
Jonas Devlieghere58d4a392018-07-29 14:56:15 +000040bool generateUniversalBinary(SmallVectorImpl<ArchAndFile> &ArchFiles,
Frederic Rissa642d2c2015-10-08 22:35:53 +000041 StringRef OutputFileName, const LinkOptions &,
42 StringRef SDKPath);
Frederic Riss3abc9b62015-08-25 23:15:26 +000043
Jonas Devlieghere20767d12019-01-07 23:27:25 +000044bool generateDsymCompanion(const DebugMap &DM, SymbolMapTranslator &Translator,
45 MCStreamer &MS, raw_fd_ostream &OutFile);
Frederic Rissef8ad012015-09-02 16:49:13 +000046
Frederic Riss3abc9b62015-08-25 23:15:26 +000047std::string getArchName(StringRef Arch);
Jonas Devlieghere3ad0c5a2018-02-22 11:32:51 +000048} // namespace MachOUtils
49} // namespace dsymutil
50} // namespace llvm
Frederic Riss7a425782015-08-05 18:27:44 +000051#endif // LLVM_TOOLS_DSYMUTIL_MACHOUTILS_H