[yaml2obj/obj2yaml] - Do not trigger llvm_unreachable when dumping/parsing relocation...
[llvm-complete.git] / tools / dsymutil / LinkUtils.h
blob0cd5600b65dc83d6fe39868a6a0e3e017c2bb593
1 //===- tools/dsymutil/LinkUtils.h - Dwarf linker utilities ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H
10 #define LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H
12 #include "SymbolMap.h"
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/Support/WithColor.h"
17 #include <string>
19 namespace llvm {
20 namespace dsymutil {
22 enum class OutputFileType {
23 Object,
24 Assembly,
27 /// The kind of accelerator tables we should emit.
28 enum class AccelTableKind {
29 Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
30 Dwarf, ///< DWARF v5 .debug_names.
31 Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
34 struct LinkOptions {
35 /// Verbosity
36 bool Verbose = false;
38 /// Skip emitting output
39 bool NoOutput = false;
41 /// Do not unique types according to ODR
42 bool NoODR = false;
44 /// Update
45 bool Update = false;
47 /// Minimize
48 bool Minimize = false;
50 /// Do not check swiftmodule timestamp
51 bool NoTimestamp = false;
53 /// Number of threads.
54 unsigned Threads = 1;
56 // Output file type.
57 OutputFileType FileType = OutputFileType::Object;
59 /// The accelerator table kind
60 AccelTableKind TheAccelTableKind;
62 /// -oso-prepend-path
63 std::string PrependPath;
65 /// The Resources directory in the .dSYM bundle.
66 Optional<std::string> ResourceDir;
68 /// Symbol map translator.
69 SymbolMapTranslator Translator;
71 LinkOptions() = default;
74 inline void warn(Twine Warning, Twine Context = {}) {
75 WithColor::warning() << Warning + "\n";
76 if (!Context.isTriviallyEmpty())
77 WithColor::note() << Twine("while processing ") + Context + "\n";
80 inline bool error(Twine Error, Twine Context = {}) {
81 WithColor::error() << Error + "\n";
82 if (!Context.isTriviallyEmpty())
83 WithColor::note() << Twine("while processing ") + Context + "\n";
84 return false;
87 } // end namespace dsymutil
88 } // end namespace llvm
90 #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H