#include "DependencyInfo.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Object/IRObjectFile.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/MachOUniversalWriter.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/LLVMDriver.h"
#include "llvm/Support/LineIterator.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TextAPI/Architecture.h"
#include <cstdlib>
#include <map>
#include <type_traits>
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::opt;
namespace {
enum ID { … };
#define PREFIX …
#include "Opts.inc"
#undef PREFIX
static constexpr opt::OptTable::Info InfoTable[] = …;
class LibtoolDarwinOptTable : public opt::GenericOptTable { … };
}
class NewArchiveMemberList;
MembersPerArchitectureMap;
static std::string OutputFile;
static std::vector<std::string> InputFiles;
static std::optional<std::string> ArchType;
enum class Operation { … };
static Operation LibraryOperation = …;
static bool DeterministicOption;
static bool NonDeterministicOption;
static std::string FileList;
static std::vector<std::string> Libraries;
static std::vector<std::string> LibrarySearchDirs;
static std::string DependencyInfoPath;
static bool VersionOption;
static bool NoWarningForNoSymbols;
static bool WarningsAsErrors;
static std::string IgnoredSyslibRoot;
static const std::array<std::string, 3> StandardSearchDirs{ … };
std::unique_ptr<DependencyInfo> GlobalDependencyInfo;
struct Config { … };
static Expected<std::string> searchForFile(const Twine &FileName) { … }
static Error processCommandLineLibraries() { … }
static Error processFileList() { … }
static Error validateArchitectureName(StringRef ArchitectureName) { … }
static uint64_t getCPUID(uint32_t CPUType, uint32_t CPUSubtype) { … }
struct MembersData { … };
class NewArchiveMemberList { … };
class MembersBuilder { … };
static Expected<SmallVector<Slice, 2>>
buildSlices(LLVMContext &LLVMCtx,
ArrayRef<OwningBinary<Archive>> OutputBinaries) { … }
static Error
checkForDuplicates(const MembersPerArchitectureMap &MembersPerArch) { … }
static Error createStaticLibrary(LLVMContext &LLVMCtx, const Config &C) { … }
static void parseRawArgs(int Argc, char **Argv) { … }
static Expected<Config> parseCommandLine(int Argc, char **Argv) { … }
int llvm_libtool_darwin_main(int Argc, char **Argv, const llvm::ToolContext &) { … }