[AMDGPU] Test codegen'ing True16 additions.
[llvm-project.git] / llvm / tools / dsymutil / LinkUtils.h
blob88c17d503689951febd0665184a08a1e009e0dda
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/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"
21 #include <string>
23 namespace llvm {
24 namespace dsymutil {
26 enum class DsymutilAccelTableKind : uint8_t {
27 None,
28 Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
29 Dwarf, ///< DWARF v5 .debug_names.
30 Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
31 Pub, ///< .debug_pubnames, .debug_pubtypes
34 enum class DsymutilDWARFLinkerType : uint8_t {
35 Apple, /// Apple`s implementation of DWARFLinker.
36 LLVM /// LLVM implementation of DWARFLinker.
39 struct LinkOptions {
40 /// Verbosity
41 bool Verbose = false;
43 /// Statistics
44 bool Statistics = false;
46 /// Verify the input DWARF.
47 bool VerifyInputDWARF = false;
49 /// Skip emitting output
50 bool NoOutput = false;
52 /// Do not unique types according to ODR
53 bool NoODR = false;
55 /// Update
56 bool Update = false;
58 /// Do not check swiftmodule timestamp
59 bool NoTimestamp = false;
61 /// Whether we want a static variable to force us to keep its enclosing
62 /// function.
63 bool KeepFunctionForStatic = false;
65 /// Type of DWARFLinker to use.
66 DsymutilDWARFLinkerType DWARFLinkerType = DsymutilDWARFLinkerType::Apple;
68 /// Use a 64-bit header when emitting universal binaries.
69 bool Fat64 = false;
71 /// Number of threads.
72 unsigned Threads = 1;
74 // Output file type.
75 DWARFLinker::OutputFileType FileType = DWARFLinker::OutputFileType::Object;
77 /// The accelerator table kind
78 DsymutilAccelTableKind TheAccelTableKind;
80 /// -oso-prepend-path
81 std::string PrependPath;
83 /// The -object-prefix-map.
84 std::map<std::string, std::string> ObjectPrefixMap;
86 /// The Resources directory in the .dSYM bundle.
87 std::optional<std::string> ResourceDir;
89 /// Symbol map translator.
90 SymbolMapTranslator Translator;
92 /// Virtual File System.
93 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
94 vfs::getRealFileSystem();
96 /// Fields used for linking and placing remarks into the .dSYM bundle.
97 /// @{
99 /// Number of debug maps processed in total.
100 unsigned NumDebugMaps = 0;
102 /// -remarks-prepend-path: prepend a path to all the external remark file
103 /// paths found in remark metadata.
104 std::string RemarksPrependPath;
106 /// The output format of the remarks.
107 remarks::Format RemarksFormat = remarks::Format::Bitstream;
109 /// Whether all remarks should be kept or only remarks with valid debug
110 /// locations.
111 bool RemarksKeepAll = true;
112 /// @}
114 LinkOptions() = default;
117 inline void warn(Twine Warning, Twine Context = {}) {
118 WithColor::warning() << Warning + "\n";
119 if (!Context.isTriviallyEmpty())
120 WithColor::note() << Twine("while processing ") + Context + "\n";
123 inline bool error(Twine Error, Twine Context = {}) {
124 WithColor::error() << Error + "\n";
125 if (!Context.isTriviallyEmpty())
126 WithColor::note() << Twine("while processing ") + Context + "\n";
127 return false;
130 } // end namespace dsymutil
131 } // end namespace llvm
133 #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H