blob: 07697418535c1fbd3a44700e07caf32953d38f4d [file] [log] [blame]
Jonas Devlieghere928fea22018-06-27 16:13:40 +00001//===- tools/dsymutil/LinkUtils.h - Dwarf linker utilities ------*- C++ -*-===//
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
10#ifndef LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H
11#define LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H
12
Jonas Devlieghere20767d12019-01-07 23:27:25 +000013#include "SymbolMap.h"
14
Jonas Devlieghere928fea22018-06-27 16:13:40 +000015#include "llvm/ADT/Twine.h"
16#include "llvm/Support/WithColor.h"
Jonas Devlieghere20767d12019-01-07 23:27:25 +000017
Jonas Devlieghere928fea22018-06-27 16:13:40 +000018#include <string>
19
20namespace llvm {
21namespace dsymutil {
22
Jonas Devliegherea5d860c2018-07-09 16:58:48 +000023enum class OutputFileType {
24 Object,
25 Assembly,
26};
27
Jonas Devlieghere7c767bd2018-07-25 23:01:38 +000028/// The kind of accelerator tables we should emit.
29enum class AccelTableKind {
30 Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
31 Dwarf, ///< DWARF v5 .debug_names.
32 Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
33};
34
Jonas Devlieghere928fea22018-06-27 16:13:40 +000035struct LinkOptions {
36 /// Verbosity
37 bool Verbose = false;
38
39 /// Skip emitting output
40 bool NoOutput = false;
41
42 /// Do not unique types according to ODR
43 bool NoODR = false;
44
45 /// Update
46 bool Update = false;
47
48 /// Minimize
49 bool Minimize = false;
50
51 /// Do not check swiftmodule timestamp
52 bool NoTimestamp = false;
53
54 /// Number of threads.
55 unsigned Threads = 1;
56
Jonas Devliegherea5d860c2018-07-09 16:58:48 +000057 // Output file type.
58 OutputFileType FileType = OutputFileType::Object;
59
Jonas Devlieghere7c767bd2018-07-25 23:01:38 +000060 /// The accelerator table kind
61 AccelTableKind TheAccelTableKind;
62
Jonas Devlieghere928fea22018-06-27 16:13:40 +000063 /// -oso-prepend-path
64 std::string PrependPath;
65
Jonas Devlieghere20767d12019-01-07 23:27:25 +000066 /// Symbol map translator.
67 SymbolMapTranslator Translator;
68
Jonas Devlieghere928fea22018-06-27 16:13:40 +000069 LinkOptions() = default;
70};
71
72inline void warn(Twine Warning, Twine Context = {}) {
73 WithColor::warning() << Warning + "\n";
74 if (!Context.isTriviallyEmpty())
75 WithColor::note() << Twine("while processing ") + Context + "\n";
76}
77
78inline bool error(Twine Error, Twine Context = {}) {
79 WithColor::error() << Error + "\n";
80 if (!Context.isTriviallyEmpty())
81 WithColor::note() << Twine("while processing ") + Context + "\n";
82 return false;
83}
84
85} // end namespace dsymutil
86} // end namespace llvm
87
88#endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H