blob: 1362896e893b5aea643261fa9e97423c39fc70d7 [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 Devliegherec0fb4b62018-06-27 16:13:40 +000025struct LinkOptions {
26 /// Verbosity
27 bool Verbose = false;
28
29 /// Skip emitting output
30 bool NoOutput = false;
31
32 /// Do not unique types according to ODR
33 bool NoODR = false;
34
35 /// Update
36 bool Update = false;
37
38 /// Minimize
39 bool Minimize = false;
40
41 /// Do not check swiftmodule timestamp
42 bool NoTimestamp = false;
43
44 /// Number of threads.
45 unsigned Threads = 1;
46
Jonas Devlieghere82dee6a2018-07-09 16:58:48 +000047 // Output file type.
48 OutputFileType FileType = OutputFileType::Object;
49
Jonas Devliegherec0fb4b62018-06-27 16:13:40 +000050 /// -oso-prepend-path
51 std::string PrependPath;
52
53 LinkOptions() = default;
54};
55
56inline void warn(Twine Warning, Twine Context = {}) {
57 WithColor::warning() << Warning + "\n";
58 if (!Context.isTriviallyEmpty())
59 WithColor::note() << Twine("while processing ") + Context + "\n";
60}
61
62inline bool error(Twine Error, Twine Context = {}) {
63 WithColor::error() << Error + "\n";
64 if (!Context.isTriviallyEmpty())
65 WithColor::note() << Twine("while processing ") + Context + "\n";
66 return false;
67}
68
69} // end namespace dsymutil
70} // end namespace llvm
71
72#endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H