Jonas Devlieghere | 928fea2 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 1 | //===- tools/dsymutil/LinkUtils.h - Dwarf linker utilities ------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H |
| 11 | #define LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H |
| 12 | |
Jonas Devlieghere | 20767d1 | 2019-01-07 23:27:25 +0000 | [diff] [blame] | 13 | #include "SymbolMap.h" |
| 14 | |
Jonas Devlieghere | 928fea2 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 15 | #include "llvm/ADT/Twine.h" |
| 16 | #include "llvm/Support/WithColor.h" |
Jonas Devlieghere | 20767d1 | 2019-01-07 23:27:25 +0000 | [diff] [blame] | 17 | |
Jonas Devlieghere | 928fea2 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 18 | #include <string> |
| 19 | |
| 20 | namespace llvm { |
| 21 | namespace dsymutil { |
| 22 | |
Jonas Devlieghere | a5d860c | 2018-07-09 16:58:48 +0000 | [diff] [blame] | 23 | enum class OutputFileType { |
| 24 | Object, |
| 25 | Assembly, |
| 26 | }; |
| 27 | |
Jonas Devlieghere | 7c767bd | 2018-07-25 23:01:38 +0000 | [diff] [blame] | 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. |
| 33 | }; |
| 34 | |
Jonas Devlieghere | 928fea2 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 35 | struct LinkOptions { |
| 36 | /// Verbosity |
| 37 | bool Verbose = false; |
| 38 | |
| 39 | /// Skip emitting output |
| 40 | bool NoOutput = false; |
| 41 | |
| 42 | /// Do not unique types according to ODR |
| 43 | bool NoODR = false; |
| 44 | |
| 45 | /// Update |
| 46 | bool Update = false; |
| 47 | |
| 48 | /// Minimize |
| 49 | bool Minimize = false; |
| 50 | |
| 51 | /// Do not check swiftmodule timestamp |
| 52 | bool NoTimestamp = false; |
| 53 | |
| 54 | /// Number of threads. |
| 55 | unsigned Threads = 1; |
| 56 | |
Jonas Devlieghere | a5d860c | 2018-07-09 16:58:48 +0000 | [diff] [blame] | 57 | // Output file type. |
| 58 | OutputFileType FileType = OutputFileType::Object; |
| 59 | |
Jonas Devlieghere | 7c767bd | 2018-07-25 23:01:38 +0000 | [diff] [blame] | 60 | /// The accelerator table kind |
| 61 | AccelTableKind TheAccelTableKind; |
| 62 | |
Jonas Devlieghere | 928fea2 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 63 | /// -oso-prepend-path |
| 64 | std::string PrependPath; |
| 65 | |
Jonas Devlieghere | 20767d1 | 2019-01-07 23:27:25 +0000 | [diff] [blame] | 66 | /// Symbol map translator. |
| 67 | SymbolMapTranslator Translator; |
| 68 | |
Jonas Devlieghere | 928fea2 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 69 | LinkOptions() = default; |
| 70 | }; |
| 71 | |
| 72 | inline void warn(Twine Warning, Twine Context = {}) { |
| 73 | WithColor::warning() << Warning + "\n"; |
| 74 | if (!Context.isTriviallyEmpty()) |
| 75 | WithColor::note() << Twine("while processing ") + Context + "\n"; |
| 76 | } |
| 77 | |
| 78 | inline bool error(Twine Error, Twine Context = {}) { |
| 79 | WithColor::error() << Error + "\n"; |
| 80 | if (!Context.isTriviallyEmpty()) |
| 81 | WithColor::note() << Twine("while processing ") + Context + "\n"; |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | } // end namespace dsymutil |
| 86 | } // end namespace llvm |
| 87 | |
| 88 | #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H |