1 //===- Driver.h -------------------------------------------------*- 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 //===----------------------------------------------------------------------===// 8 9 #ifndef LLD_MACHO_DRIVER_H 10 #define LLD_MACHO_DRIVER_H 11 12 #include "lld/Common/LLVM.h" 13 #include "llvm/ADT/Optional.h" 14 #include "llvm/ADT/StringRef.h" 15 #include "llvm/Option/OptTable.h" 16 #include "llvm/Support/MemoryBuffer.h" 17 18 namespace lld { 19 namespace macho { 20 21 class DylibFile; 22 class InputFile; 23 24 class MachOOptTable : public llvm::opt::OptTable { 25 public: 26 MachOOptTable(); 27 llvm::opt::InputArgList parse(ArrayRef<const char *> argv); 28 void printHelp(const char *argv0, bool showHidden) const; 29 }; 30 31 // Create enum with OPT_xxx values for each option in Options.td 32 enum { 33 OPT_INVALID = 0, 34 #define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11, _12) OPT_##ID, 35 #include "Options.inc" 36 #undef OPTION 37 }; 38 39 void parseLCLinkerOption(InputFile*, unsigned argc, StringRef data); 40 41 std::string createResponseFile(const llvm::opt::InputArgList &args); 42 43 // Check for both libfoo.dylib and libfoo.tbd (in that order). 44 llvm::Optional<std::string> resolveDylibPath(llvm::StringRef path); 45 46 llvm::Optional<DylibFile *> loadDylib(llvm::MemoryBufferRef mbref, 47 DylibFile *umbrella = nullptr); 48 49 uint32_t getModTime(llvm::StringRef path); 50 51 void printArchiveMemberLoad(StringRef reason, const InputFile *); 52 53 } // namespace macho 54 } // namespace lld 55 56 #endif 57