Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / llvm / tools / dsymutil / LinkUtils.h
blob0f31334cd317a13e3ce6c4830669c78d15d339d9
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/WithColor.h"
18 #include <string>
20 namespace llvm {
21 namespace dsymutil {
23 enum class OutputFileType {
24 Object,
25 Assembly,
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.
35 struct LinkOptions {
36 /// Verbosity
37 bool Verbose = false;
39 /// Skip emitting output
40 bool NoOutput = false;
42 /// Do not unique types according to ODR
43 bool NoODR = false;
45 /// Update
46 bool Update = false;
48 /// Minimize
49 bool Minimize = false;
51 /// Do not check swiftmodule timestamp
52 bool NoTimestamp = false;
54 /// Number of threads.
55 unsigned Threads = 1;
57 // Output file type.
58 OutputFileType FileType = OutputFileType::Object;
60 /// The accelerator table kind
61 AccelTableKind TheAccelTableKind;
63 /// -oso-prepend-path
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.
73 /// @{
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;
85 /// @}
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";
100 return false;
103 } // end namespace dsymutil
104 } // end namespace llvm
106 #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H