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/VirtualFileSystem.h"
17 #include "llvm/Support/WithColor.h"
19 #include "llvm/DWARFLinker/DWARFLinker.h"
20 #include "llvm/DWARFLinker/DWARFStreamer.h"
31 bool Statistics
= false;
33 /// Skip emitting output
34 bool NoOutput
= false;
36 /// Do not unique types according to ODR
42 /// Do not check swiftmodule timestamp
43 bool NoTimestamp
= false;
45 /// Whether we want a static variable to force us to keep its enclosing
47 bool KeepFunctionForStatic
= false;
49 /// Number of threads.
53 OutputFileType FileType
= OutputFileType::Object
;
55 /// The accelerator table kind
56 AccelTableKind TheAccelTableKind
;
59 std::string PrependPath
;
61 /// The -object-prefix-map.
62 std::map
<std::string
, std::string
> ObjectPrefixMap
;
64 /// The Resources directory in the .dSYM bundle.
65 Optional
<std::string
> ResourceDir
;
67 /// Symbol map translator.
68 SymbolMapTranslator Translator
;
70 /// Virtual File System.
71 llvm::IntrusiveRefCntPtr
<llvm::vfs::FileSystem
> VFS
=
72 vfs::getRealFileSystem();
74 /// Fields used for linking and placing remarks into the .dSYM bundle.
77 /// Number of debug maps processed in total.
78 unsigned NumDebugMaps
= 0;
80 /// -remarks-prepend-path: prepend a path to all the external remark file
81 /// paths found in remark metadata.
82 std::string RemarksPrependPath
;
84 /// The output format of the remarks.
85 remarks::Format RemarksFormat
= remarks::Format::Bitstream
;
89 LinkOptions() = default;
92 inline void warn(Twine Warning
, Twine Context
= {}) {
93 WithColor::warning() << Warning
+ "\n";
94 if (!Context
.isTriviallyEmpty())
95 WithColor::note() << Twine("while processing ") + Context
+ "\n";
98 inline bool error(Twine Error
, Twine Context
= {}) {
99 WithColor::error() << Error
+ "\n";
100 if (!Context
.isTriviallyEmpty())
101 WithColor::note() << Twine("while processing ") + Context
+ "\n";
105 } // end namespace dsymutil
106 } // end namespace llvm
108 #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H