blob: f0abd888b52972033c580e3dd93b8dab31c330d1 [file] [log] [blame]
Jonas Devliegherec0fb4b62018-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
13#include "llvm/ADT/Twine.h"
14#include "llvm/Support/WithColor.h"
15#include <string>
16
17namespace llvm {
18namespace dsymutil {
19
Jonas Devlieghere82dee6a2018-07-09 16:58:48 +000020enum class OutputFileType {
21 Object,
22 Assembly,
23};
24
Jonas Devlieghere743d3512018-07-25 23:01:38 +000025/// The kind of accelerator tables we should emit.
26enum class AccelTableKind {
27 Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
28 Dwarf, ///< DWARF v5 .debug_names.
29 Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
30};
31
Jonas Devliegherec0fb4b62018-06-27 16:13:40 +000032struct LinkOptions {
33 /// Verbosity
34 bool Verbose = false;
35
36 /// Skip emitting output
37 bool NoOutput = false;
38
39 /// Do not unique types according to ODR
40 bool NoODR = false;
41
42 /// Update
43 bool Update = false;
44
45 /// Minimize
46 bool Minimize = false;
47
48 /// Do not check swiftmodule timestamp
49 bool NoTimestamp = false;
50
51 /// Number of threads.
52 unsigned Threads = 1;
53
Jonas Devlieghere82dee6a2018-07-09 16:58:48 +000054 // Output file type.
55 OutputFileType FileType = OutputFileType::Object;
56
Jonas Devlieghere743d3512018-07-25 23:01:38 +000057 /// The accelerator table kind
58 AccelTableKind TheAccelTableKind;
59
Jonas Devliegherec0fb4b62018-06-27 16:13:40 +000060 /// -oso-prepend-path
61 std::string PrependPath;
62
63 LinkOptions() = default;
64};
65
66inline void warn(Twine Warning, Twine Context = {}) {
67 WithColor::warning() << Warning + "\n";
68 if (!Context.isTriviallyEmpty())
69 WithColor::note() << Twine("while processing ") + Context + "\n";
70}
71
72inline bool error(Twine Error, Twine Context = {}) {
73 WithColor::error() << Error + "\n";
74 if (!Context.isTriviallyEmpty())
75 WithColor::note() << Twine("while processing ") + Context + "\n";
76 return false;
77}
78
79} // end namespace dsymutil
80} // end namespace llvm
81
82#endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H