e8787453829507d5e2ed920ea24a90196b5f50b9
[oota-llvm.git] / tools / dsymutil / dsymutil.h
1 //===- tools/dsymutil/dsymutil.h - dsymutil high-level functionality ------===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 ///
12 /// This file contains the class declaration for the code that parses STABS
13 /// debug maps that are embedded in the binaries symbol tables.
14 ///
15 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
17 #define LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H
18
19 #include "DebugMap.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/ErrorOr.h"
22 #include <memory>
23
24 namespace llvm {
25 namespace dsymutil {
26
27 struct LinkOptions {
28   bool Verbose;  ///< Verbosity
29   bool NoOutput; ///< Skip emitting output
30   bool NoODR;    ///< Do not unique types according to ODR
31
32   LinkOptions() : Verbose(false), NoOutput(false) {}
33 };
34
35 /// \brief Extract the DebugMaps from the given file.
36 /// The file has to be a MachO object file. Multiple debug maps can be
37 /// returned when the file is universal (aka fat) binary.
38 llvm::ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
39 parseDebugMap(StringRef InputFile, ArrayRef<std::string> Archs,
40               StringRef PrependPath, bool Verbose, bool InputIsYAML);
41
42 /// \brief Dump the symbol table
43 bool dumpStab(StringRef InputFile, ArrayRef<std::string> Archs,
44               StringRef PrependPath = "");
45
46 /// \brief Link the Dwarf debuginfo as directed by the passed DebugMap
47 /// \p DM into a DwarfFile named \p OutputFilename.
48 /// \returns false if the link failed.
49 bool linkDwarf(StringRef OutputFilename, const DebugMap &DM,
50                const LinkOptions &Options);
51
52 /// \brief Exit the dsymutil process, cleaning up every temporary
53 /// files that we created.
54 LLVM_ATTRIBUTE_NORETURN void exitDsymutil(int ExitStatus);
55
56 void warn(const Twine &Warning, const Twine &Context);
57 bool error(const Twine &Error, const Twine &Context);
58 }
59 }
60 #endif // LLVM_TOOLS_DSYMUTIL_DSYMUTIL_H