diff options
Diffstat (limited to 'llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp')
-rw-r--r-- | llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp index 8d4529c..5fec847 100644 --- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp +++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "DependencyInfo.h" #include "llvm/BinaryFormat/Magic.h" #include "llvm/IR/LLVMContext.h" #include "llvm/Object/ArchiveWriter.h" @@ -87,6 +88,12 @@ static cl::list<std::string> LibrarySearchDirs( " libraries"), cl::Prefix, cl::cat(LibtoolCategory)); +static cl::opt<std::string> DependencyInfoPath( + "dependency_info", + cl::desc("Write an Xcode dependency info file describing the dependencies " + "of the created library"), + cl::cat(LibtoolCategory)); + static cl::opt<bool> VersionOption("V", cl::desc("Print the version number and exit"), cl::cat(LibtoolCategory)); @@ -109,6 +116,8 @@ static const std::array<std::string, 3> StandardSearchDirs{ "/usr/local/lib", }; +std::unique_ptr<DependencyInfo> GlobalDependencyInfo; + struct Config { bool Deterministic = true; // Updated by 'D' and 'U' modifiers. uint32_t ArchCPUType; @@ -116,7 +125,6 @@ struct Config { }; static Expected<std::string> searchForFile(const Twine &FileName) { - auto FindLib = [FileName](ArrayRef<std::string> SearchDirs) -> Optional<std::string> { for (StringRef Dir : SearchDirs) { @@ -125,6 +133,8 @@ static Expected<std::string> searchForFile(const Twine &FileName) { if (sys::fs::exists(Path)) return std::string(Path); + + GlobalDependencyInfo->addMissingInput(Path); } return None; }; @@ -652,6 +662,11 @@ static Expected<Config> parseCommandLine(int Argc, char **Argv) { return C; } + GlobalDependencyInfo = + DependencyInfoPath.empty() + ? std::make_unique<DummyDependencyInfo>() + : std::make_unique<DependencyInfo>(DependencyInfoPath); + if (OutputFile.empty()) { std::string Error; raw_string_ostream Stream(Error); @@ -686,6 +701,9 @@ static Expected<Config> parseCommandLine(int Argc, char **Argv) { MachO::getArchitectureFromName(ArchType)); } + GlobalDependencyInfo->write("llvm-libtool-darwin " LLVM_VERSION_STRING, + InputFiles, OutputFile); + return C; } |