1 //===- tools/dsymutil/LinkUtils.h - Dwarf linker utilities ------*- C++ -*-===//
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
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/Remarks/RemarkFormat.h"
16 #include "llvm/Support/WithColor.h"
23 enum class OutputFileType
{
28 /// The kind of accelerator tables we should emit.
29 enum 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.
39 /// Skip emitting output
40 bool NoOutput
= false;
42 /// Do not unique types according to ODR
49 bool Minimize
= false;
51 /// Do not check swiftmodule timestamp
52 bool NoTimestamp
= false;
54 /// Number of threads.
58 OutputFileType FileType
= OutputFileType::Object
;
60 /// The accelerator table kind
61 AccelTableKind TheAccelTableKind
;
64 std::string PrependPath
;
66 /// The Resources directory in the .dSYM bundle.
67 Optional
<std::string
> ResourceDir
;
69 /// Symbol map translator.
70 SymbolMapTranslator Translator
;
72 /// Fields used for linking and placing remarks into the .dSYM bundle.
75 /// Number of debug maps processed in total.
76 unsigned NumDebugMaps
= 0;
78 /// -remarks-prepend-path: prepend a path to all the external remark file
79 /// paths found in remark metadata.
80 std::string RemarksPrependPath
;
82 /// The output format of the remarks.
83 remarks::Format RemarksFormat
= remarks::Format::Bitstream
;
87 LinkOptions() = default;
90 inline void warn(Twine Warning
, Twine Context
= {}) {
91 WithColor::warning() << Warning
+ "\n";
92 if (!Context
.isTriviallyEmpty())
93 WithColor::note() << Twine("while processing ") + Context
+ "\n";
96 inline bool error(Twine Error
, Twine Context
= {}) {
97 WithColor::error() << Error
+ "\n";
98 if (!Context
.isTriviallyEmpty())
99 WithColor::note() << Twine("while processing ") + Context
+ "\n";
103 } // end namespace dsymutil
104 } // end namespace llvm
106 #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H