Jonas Devlieghere | c0fb4b6 | 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 | |
| 13 | #include "llvm/ADT/Twine.h" |
| 14 | #include "llvm/Support/WithColor.h" |
| 15 | #include <string> |
| 16 | |
| 17 | namespace llvm { |
| 18 | namespace dsymutil { |
| 19 | |
Jonas Devlieghere | 82dee6a | 2018-07-09 16:58:48 +0000 | [diff] [blame] | 20 | enum class OutputFileType { |
| 21 | Object, |
| 22 | Assembly, |
| 23 | }; |
| 24 | |
Jonas Devlieghere | c0fb4b6 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 25 | struct LinkOptions { |
| 26 | /// Verbosity |
| 27 | bool Verbose = false; |
| 28 | |
| 29 | /// Skip emitting output |
| 30 | bool NoOutput = false; |
| 31 | |
| 32 | /// Do not unique types according to ODR |
| 33 | bool NoODR = false; |
| 34 | |
| 35 | /// Update |
| 36 | bool Update = false; |
| 37 | |
| 38 | /// Minimize |
| 39 | bool Minimize = false; |
| 40 | |
| 41 | /// Do not check swiftmodule timestamp |
| 42 | bool NoTimestamp = false; |
| 43 | |
| 44 | /// Number of threads. |
| 45 | unsigned Threads = 1; |
| 46 | |
Jonas Devlieghere | 82dee6a | 2018-07-09 16:58:48 +0000 | [diff] [blame] | 47 | // Output file type. |
| 48 | OutputFileType FileType = OutputFileType::Object; |
| 49 | |
Jonas Devlieghere | c0fb4b6 | 2018-06-27 16:13:40 +0000 | [diff] [blame] | 50 | /// -oso-prepend-path |
| 51 | std::string PrependPath; |
| 52 | |
| 53 | LinkOptions() = default; |
| 54 | }; |
| 55 | |
| 56 | inline void warn(Twine Warning, Twine Context = {}) { |
| 57 | WithColor::warning() << Warning + "\n"; |
| 58 | if (!Context.isTriviallyEmpty()) |
| 59 | WithColor::note() << Twine("while processing ") + Context + "\n"; |
| 60 | } |
| 61 | |
| 62 | inline bool error(Twine Error, Twine Context = {}) { |
| 63 | WithColor::error() << Error + "\n"; |
| 64 | if (!Context.isTriviallyEmpty()) |
| 65 | WithColor::note() << Twine("while processing ") + Context + "\n"; |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | } // end namespace dsymutil |
| 70 | } // end namespace llvm |
| 71 | |
| 72 | #endif // LLVM_TOOLS_DSYMUTIL_LINKOPTIONS_H |